提交时间:2024-08-20 09:14:41
运行 ID: 168278
#include <bits/stdc++.h> using namespace std; int a[1050][1050]; int main() { int n, m; cin >> n >> m; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { if (i == 1 && j == 1) a[i][j] = 1; else a[i][j] = a[i - 1][j] + a[i][j - 1]; } } for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { cout << a[i][j] << " "; } cout << endl; } cout << a[n][m] << endl; return 0; }