| ||||||||||
| 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 | |||||||||
请大牛们来帮我看看代码!超时超晕了!#include <stdio.h>
#include <math.h>
int yi[250002];
void main()
{
int H,out;
int i,j,n;
n=sqrt(250001);
for(i=1;i<=n;i++)
{
if(yi[i]!=0)continue;
for(j=i;4*i*j+i+j<=250001;j++)
{
if(yi[j]==0)yi[4*i*j+i+j]=1;
else yi[4*i*j+i+j]=2;
}
}
while(1)
{
scanf("%d",&H);
if(0==H)break;
out=0;
n=(H-1)/4;
for(i=1;i<=n;i++)
if(yi[i]==1)out++;
printf("%d %d\n",H,out);
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator