-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathH.cpp
More file actions
82 lines (79 loc) · 1.82 KB
/
Copy pathH.cpp
File metadata and controls
82 lines (79 loc) · 1.82 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
********************
Author : Sahil Kundu
********************
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define mod 1000000007
#define pb(i) push_back(i)
#define f first
#define s second
#define mk(l,r) make_pair(l,r)
#define vi vector<int>
#define vl vector<ll>
#define vch vector<char>
#define all(vc) vc.begin(),vc.end()
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ms(i,j) memset(i,j,sizeof i)
#define w(t) while(t--)
#define len(s) s.length()
#define rep(i,n) for(ll i=0;i<(n);++i)
#define repa(i,n) for(ll i=n;i>=0;i--)
#define repx(i,x,n) for(ll i=x;i<n;i++)
#define yes cout<<"Yes\n"
#define no cout<<"No\n"
#define PI 3.14159265358979323846
#define fastIO ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
const ll MAX=1e5+5;
const ll INF=2e18;
int ans=0,l1,l2;
#define INPUT_OUTPUT {\
freopen("input.txt","r",stdin);\
freopen("output.txt","w",stdout);\
}
// logical code of program starts here.
void solve()
{
ll n,m;
cin>>n>>m;
char mtx[n+1][m+1];
rep(i,n)
rep(j,m)cin>>mtx[i+1][j+1];
ll dp[n+1][m+1];
ms(dp,0);
rep(i,n+1)
rep(j,m+1)
{
if(i==0 or j==0)
continue;
if(mtx[i][j]=='#')
dp[i][j]=0;
else if(i==1 and j==1)
dp[i][j]=1;
else
dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
}
cout<<dp[n][m]<<endl;
}
// mian function
int main()
{
//INPUT_OUTPUT;//file handling
fastIO;// fast input output
clock_t start, end;
start = clock();
int t;
t=1;
//cin>>t;
w(t) solve();
end = clock();
double time_taken = double(end - start)/double(CLOCKS_PER_SEC);
clog << "Time taken by program is : " << fixed
<< time_taken << setprecision(5);
clog << " sec " << endl;
return 0;
}