-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcses_1638.cpp
More file actions
33 lines (30 loc) · 742 Bytes
/
cses_1638.cpp
File metadata and controls
33 lines (30 loc) · 742 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
#include <iostream>
#include <string>
#include <vector>
using namespace std;
const int MOD = 1e9 + 7;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<string> g(n);
vector<vector<int>> dp(n, vector<int> (n, 0));
for (int i = 0; i < n; i++)
cin >> g[i];
if (g[0][0] == '.')
dp[0][0] = 1;
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
{
if (i - 1 >= 0 && g[i][j] == '.')
dp[i][j] += dp[i - 1][j];
dp[i][j] %= MOD;
if (j - 1 >= 0 && g[i][j] == '.')
dp[i][j] += dp[i][j - 1];
dp[i][j] %= MOD;
}
cout << dp[n - 1][n - 1] << "\n";
return 0;
}