Answer the question
In order to leave comments, you need to log in
Why can't I run the code in visual studio?
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int main() {
long long matr[1001][1001];
int n;
cin >> n;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
char c;
cin >> c;
matr[i][j] = c == '*' ? LLONG_MAX : 0;
}
}
//queue<pair<int, int>>q;
//q.push({ 0, 0 });
const int di[2] = { 0,1 };
const int dj[2] = { 1,0 };
while (0) {
pair<int, int> t;
//t = q.front();
//q.pop();
int i = t.first;
int j = t.second;
if (i == n - 1 && j == n - 1) continue;
for (int t = 0; t < 2; t++) {
if (i + di[t] < n && j + dj[t] < n && matr[i+di[t]][j+dj[t]]!=LLONG_MAX) {
matr[i + di[t]][j + dj[t]] += matr[i][j];
matr[i + di[t]][j + dj[t]] %= mod;
//q.push({ i + di[t],j + dj[t] });
}
}
}
cout << matr[n - 1][n - 1];
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question