文章
72
粉丝
142
获赞
5
访问
57.6k
#include<iostream>
#include<cstring>
using namespace std;
const int maxn = 1005;
int a[maxn][maxn];
int main() {
int n;
while (cin >> n) {
if (n == 0) break;
memset(a, 0, sizeof(a));
for (int i = 1; i <= n; i++) {
a[i][i] = 1;
a[i][1] = 1;
}
for (int i = 3; i <= n; i++) {
for (int j = 2; j < i; j++) {
a[i][j] = a[i - 1][j - 1] + a[i - 1][j];
}
}
&n...
登录后发布评论
仔细看题目的样例输出