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

Time Limit Exceed

Posted by gothree at 2006-11-15 20:39:02 on Problem 2909
#include <stdio.h>
int store[3513]={2,0};
int main()
{
    int a[16385]={0},num,k=1,i,j,input=0;
    for(i=0;i<16385;i++)
    {
        if(a[i])
            continue;
        store[k++]=2*i+3;
        for(j=i+1;j<16385;j++)
            if(!a[i]&&((2*j+3)%(2*i+3)==0))
                a[j]=1;
    }
	while(scanf("%d",&input)==1&&input)
	{
		int answer=0;
		if(input==4)
			answer=1;
		else
		{
			for(i=1;store[i]<=input/2;i++)
				for(j=1;store[j]<=input;j++)
				{
					if(store[j]+store[i]==input)
					{
						answer++;
						break;
					}
				}
		}
		printf("%d\n",answer);
	}
    return 0;
}
可是总是Time Limit Exceed,这题时间怎么那么快啊

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