-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathH.cpp
More file actions
37 lines (29 loc) · 638 Bytes
/
H.cpp
File metadata and controls
37 lines (29 loc) · 638 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = 1e9 + 7;
int32_t main()
{
int n, m; cin >> n >> m;
char grid[n+1][m+1];
int dp[n+1][m+1];
memset(dp, 0, sizeof(dp));
for(int i = 1; i <= n; i++)
{
for(int j = 1; j <= m; j++)
{
cin >> grid[i][j];
}
}
dp[0][1] = 1;
for(int i = 1; i <= n; i++)
{
for(int j = 1; j <= m; j++)
{
if(grid[i][j] == '#') dp[i][j] = 0;
else dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
dp[i][j] %= MOD;
}
}
cout << dp[n][m] << "\n";
}