| ||||||||||
| 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 shusu(int x);
main()
{
int n;
int i,j,z;
A: while(scanf("%d",&n)&&n)
{
for(i=1;i<n/2;i++)
for(j=i;j<n;j++)
{
if((shusu(i)&&shusu(j))&&(i+j==n)&&(i!=1)&&(i%2!=0))
{
printf("%d = %d + %d\n",n,i,j);
goto A;
}
}
}
}
int shusu(int x)
{
int flag=1;
int i;
for(i=2;i<=sqrt(x);i++)
{
if(x%i==0)
{
flag=0;
break;
}
}
return flag;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator