标签:print cal return set 输入 == 依次 iostream nbsp
4
1 1 1 1 2 1 1 3 3 1
#include <cstdio> #include <iostream> #include <cmath> #include <string> #include <cstring> #include <algorithm> #include <queue> #include <vector> #include <map> using namespace std; #define ll long long const int maxn = 5100; int n, pascal[100+8][100+8]; int main() { scanf("%d", &n); memset(pascal, 0, sizeof(pascal)); for(int i = 0; i<n; i++)///for(int i = 0; i<10000+8; i++) { for(int j = 0; j <= i; j++) { if(j == 0)pascal[i][0] = 1; else { pascal[i][j] = pascal[i-1][j-1]+pascal[i-1][j]; } } } for(int i = 0; i<n; i++) { bool flag = 0; for(int j = 0; j <= i; j++) { if(flag)printf(" "); flag = 1; printf("%d", pascal[i][j]); } printf("\n"); } return 0; }
标签:print cal return set 输入 == 依次 iostream nbsp
原文地址:https://www.cnblogs.com/RootVount/p/11250020.html