个人赛连秃两场了。。。
不过今天见识到了Python的威力。。。
还是有点欣慰的。。。
Python:
a=1L n=input() for i in range(1,n+1): b=a+1 a*=b print b
VS
C++:
/************************************************************************* > File Name: A.cpp > Author: Chierush > Mail: qinxiaojie1@gmail.com > Created Time: 2013年07月31日 星期三 09时32分59秒 ************************************************************************/ #include <iostream> #include <cstring> #include <cstdlib> #include <set> #include <cstdio> #include <string> #include <vector> #include <map> #include <cmath> #include <algorithm> #define LL long long #define LLU unsigned long long using namespace std; LL x[50000],y[50000],z[50000]; int nx,ny,nz; void print(int w) { printf("%I64d",x[nx--]); for (int i=nx;i>=0;--i) printf("%.9I64d",x[i]); printf(" "); } int main() { // freopen("a.txt","w",stdout); int n; scanf("%d",&n); nx=0,ny=0,nz=0; x[0]=2,y[0]=2; for (int q=1;q<=n;++q) { print(q); memcpy(x,y,sizeof(y)); nx=ny; LL k=0; ++x[0]; for (int i=0;i<=nx;++i) { k=x[i]/1000000000; x[i]=x[i]%1000000000; if (k==0) break; } if (k) x[++nx]=k; memset(z,0,sizeof(z)); for (int i=0;i<=nx;++i) for (int j=0;j<=ny;++j) { LL u=x[i]*y[j]+z[i+j]; z[i+j]=u%1000000000; z[i+j+1]+=u/1000000000; } k=0; nz=49999; while (!z[nz]) --nz; for (int i=0;i<=nz;++i) { z[i]+=k; k=z[i]/1000000000; z[i]%=1000000000; } while (k) { ++nz; z[nz]=k%1000000000; k/=1000000000; } //printf("--%d ",nx); memcpy(y,z,sizeof(z)); ny=nz; } return 0; }