Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

用类似于进制转换的方法做,o(n^2) 只需用到大数乘常数和大数加大数

Posted by seu_cl at 2009-08-29 19:22:32 on Problem 3742
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator