标签:mes iostream end cout while ++ mamicode ima using
#include <cstdio> #include <iostream> #include <cstring> using namespace std; int main() { int n; int a[33][33]; while(scanf("%d", &n) != EOF) { for(int i = 1; i <= n; ++ i) { a[i][1] = 1; } for(int i = 1; i <= n; ++ i) { for(int j = 1; j <= i; ++ j) { if(j == i) a[i][j] = 1; } } for(int i = 1; i <= n; ++ i) { for(int j = 2; j < i; ++ j) { a[i][j] = a[i-1][j-1] + a[i-1][j]; } } for(int i = 1; i <= n; ++ i) { for(int j = 1; j <= i; ++ j) { if(j == i) cout << a[i][j]; else cout << a[i][j] << " "; } cout << endl; } cout << endl; } return 0; }
标签:mes iostream end cout while ++ mamicode ima using
原文地址:https://www.cnblogs.com/mjn1/p/11275351.html