-
Notifications
You must be signed in to change notification settings - Fork 5
/
code(H - Grid 1).cpp
49 lines (42 loc) · 993 Bytes
/
code(H - Grid 1).cpp
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
38
39
40
41
42
43
44
45
46
47
48
49
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define endl '\n'
#define pb push_back
#define mp make_pair
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main()
{
fast_io;
ll ro,co;
cin>>ro>>co;
ll mod = 1e9+7;
vector< vector<ll>> dp(ro+1, vector<ll> (co+1,0));
dp[0][0] = 1;
for(ll i=0;i<ro;i++)
{
string s;
cin>>s;
for(ll j=0;j<co;j++)
{
if(s[j] == '.')
{
if(i>0)
{
dp[i][j] += dp[i-1][j];
dp[i][j] %= mod;
}
if(j>0)
{
dp[i][j] += dp[i][j-1];
dp[i][j] %= mod;
}
}
else
dp[i][j] = 0;
}
}
cout<<dp[ro-1][co-1]<<endl;
return 0;
}