标签:i++ ret ios name temp end str 杨辉三角 class
#include<iostream>
#include<vector>
using namespace std;
int main(){
int n;
cin>>n;
vector<int> vi(36, 0);
vi[1]=1;
for(int i=1; i<=n; i++){
vector<int> temp(36,0);
for(int j=1; j<=i; j++){
if(j==1) cout<<vi[j];
else cout<<" "<<vi[j];
temp[j]=vi[j-1]+vi[j];
}
cout<<endl;
temp[i+1]=1;
vi=temp;
}
return 0;
}
标签:i++ ret ios name temp end str 杨辉三角 class
原文地址:https://www.cnblogs.com/A-Little-Nut/p/10316823.html