Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<ctime>
- #include<map>
- #include<vector>
- #include<queue>
- using namespace std;
- int n;
- int dp[1000][1000];
- char square[1000][1000];
- int main()
- {
- cin>>n;
- for(int i=0; i<n; i++){
- for(int j=0; j<n; j++){
- cin>>square[i][j];
- }
- }
- for(int i=0; i<n; i++){
- for(int j=0; j<n; j++){
- dp[i][j]=0;
- }
- }
- if(square[0][0] != '*') {
- dp[0][0] = 1;
- }
- int MOD = 1e9 + 7;
- for(int i = 0; i < n; i++) {
- for(int j = 0; j < n; j++) {
- if(i + 1 < n and square[i + 1][j] != '*') {
- dp[i + 1][j] += dp[i][j];
- dp[i + 1][j] %= MOD;
- }
- if(j + 1 < n and square[i][j + 1] != '*') {
- dp[i][j + 1] += dp[i][j];
- dp[i][j + 1] %= MOD;
- }
- }
- }
- cout << dp[n - 1][n - 1] << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement