| ||||||||||
| 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 | |||||||||
为什么会是WRONG呢?所有测试数据都对...#include<stdio.h>
#include<math.h>
int main()
{
long n,i,j,f;
while(scanf("%ld",&n)==1&&n!=0)
{
for(i=n-3;i>=n/2;i-=2)
{
for(j=3;j<=sqrtl(i)+1;j+=2)
{
f=1;
if(i%j==0)
{
f=0;
break;
}
}
if(f==1)
{
if(n-i==3)
f=2;
else for(j=3;j<=sqrtl(n-i)+1;j+=2)
{
f=2;
if((n-i)%j==0)
{
f=0;
break;
}
}
}
if(f==2)
{
printf("%ld = %ld + %ld\n",n,n-i,i);
break;
}
}
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator