标签:ace while include stream str %x col return iostream
1 #include<iostream> 2 #include<cstdio> 3 using namespace std; 4 const int maxn=1e5+7; 5 int ans[maxn],l; 6 void multi(int x){ 7 for(int i=1;i<=l;i++) ans[i]*=x; 8 for(int i=2;i<=l;i++){ 9 ans[i]+=(ans[i-1]/10); 10 ans[i-1]%=10; 11 } 12 while(ans[l]>9){ 13 ans[l+1]=ans[l]/10; 14 ans[l]%=10; 15 l++; 16 } 17 } 18 void divis(int x){ 19 for(int i=l;i>=1;i--){ 20 ans[i-1]+=((ans[i]%x)*10); 21 ans[i]/=x; 22 } 23 while(ans[l]==0) l--; 24 } 25 int main(){ 26 int n;cin>>n; 27 ans[1]=1;l=1; 28 for(int i=n+1;i<=2*n;i++) multi(i); 29 for(int i=1;i<=n;i++) divis(i); 30 divis(n+1); 31 for(int i=l;i>=1;i--) cout<<ans[i]; 32 cout<<endl; 33 return 0; 34 }
标签:ace while include stream str %x col return iostream
原文地址:https://www.cnblogs.com/lcan/p/9542793.html