文章
71
粉丝
142
获赞
5
访问
52.4k
#include<iostream>
#include<cstring>
using namespace std;
const int maxn = 25;
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];
}
}
&nbs...
登录后发布评论
数组开小了