文章
68
粉丝
691
获赞
26
访问
578.3k
#include<iostream>
#include<cstdio>
#include<string>
#include<string.h>
#include<algorithm>
#include<map>
#include<queue>
#include<vector>
#include<set>
using namespace std;
#define ll long long
#define vec vector<ll>
#define MAX 25
#define inf 0x3fffffff
#define P pair<ll,ll>
ll t[MAX][MAX];
int main() {
ll n;
for (int i = 1; i <= 20; i++) {
for (int j = 1; j <= i; j++) {
if (i == j || j == 1)t[i][j] = 1;
else {
t[i][j] = t[i - 1][j] + t[i - 1][j - 1];
}
}
}
while (cin >> n) {
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= i; j++) {
cout << t[i][j] << ' ';
}
cout << endl;
}
}
}
登录后发布评论
暂无评论,来抢沙发