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

为什么会超时呢??实在是无解了~~~~

Posted by swust20095862 at 2010-08-24 17:21:22 on Problem 2748
#include<stdio.h>
long a[100000];
main()
{
	long t;
	long i,j,k;
	long n;
	long a1=1;
	long max=2;
	a[0]=1;
	a[1]=1;
	a[2]=2;
	for(i=3;i<75000;i++)
	{
		a1=(a1+a[i-1])%100000;
		max=(max+a1)%100000;
		a[i]=max;
	}
	scanf("%ld",&t);
	while(t--)
	{
		scanf("%ld",&n);
		k=n%75000;
		printf("%ld\n",a[k]);
	}
	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