Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
112339 | 陈志轩 | 不同路径 | C++ | 通过 | 100 | 0 MS | 260 KB | 912 | 2023-11-25 16:56:17 |
using namespace std; long long a[2005][2005]; int main(){ int n,m; cin>>n>>m; for (int i = 1;i <= n;i++){ for (int j = 1;j <= m;j++){ char s; cin>>s; if (s == '1'){ a[i][j] = -1; } else{ a[i][j] = 0; } } } a[1][1] = 1; for (int i = 1;i <= n;i++){ for (int j = 1;j <= m;j++){ if (a[i][j] == -1){ a[i][j] = 0; } else if (i == 1 && j != 1){ a[i][j] = a[i][j - 1]; } else if (i != 1 && j == 1){ a[i][j] = a[i - 1][j]; } else if (i != 1 && j != 1){ a[i][j] = a[i][j - 1] + a[i - 1][j]; } } } cout<<a[n][m]<<endl; return 0; }
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0