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

奇怪 求why

Posted by Swal_MJ at 2010-11-29 17:52:52 on Problem 2229
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
int f[1000010]={0};
int main()
{
	int n,i,j,k,sign;
		while(scanf("%d",&n)!=EOF)
		{
				f[0]=0;
				f[1]=1;
				f[2]=2;
				for(i=3;i<=n;i++)
				{
					if(i%2)
						f[i]=f[i-1];
					else
						f[i]=f[i/2]%1000000000+f[i-2]%1000000000;//   改成f[i]=(f[i/2]+f[i-2])/1000000000;就ac!。。
				}
				printf("%d\n",f[n]);
				memset(f,0,sizeof(f));
		}
	//system("pause");
return 0;
}

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