Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
用类似于进制转换的方法做,o(n^2) 只需用到大数乘常数和大数加大数int main() { int i,j,n,t; bignum a[201],b[201],c[201]; while (cin>>n>>t) { for (i=0;i<=n;i++) cin>>a[i]; for (i=0;i<=n;i++) { for (j=n-i-1;j>=0;j--) { c[j]=a[j+1]; a[j]+=a[j+1]*t; } b[i]=a[0]; for (j=n-i-1;j>=0;j--) a[j]=c[j]; } for (i=0;i<n;i++) cout<<b[i]<<" "; cout<<b[i]<<endl; } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator