| ||||||||||
| 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 | |||||||||
Re:WHY WRONG ANSWER?????In Reply To:WHY WRONG ANSWER????? Posted by:rockzero at 2008-02-16 21:14:15 > #include <stdio.h>
>
> char flag[1000001]={'\0'};
> void creat()
> {
> unsigned long i,j;
> for(i=2;i<1000001;i++)
> {if(flag[i]=='\0')
> {for(j=i;j*i<1000001;j++)
> flag[i*j]='1';}}
> }
> int main()
> {
> unsigned long num,k;
>
>
> creat();
>
>
> scanf("%lu",&num);
> while(num>0)
> {
> for(k=3;k<=num/2;k++)
> {
> if((flag[k]=='\0')&&(flag[num-k]=='\0'))
> {printf("%lu = %lu + %lu\n",num,k,num-k);
> break;}
> }
> if(k>num/2)
> printf("Goldbach's conjecture is wrong.");
> scanf("%lu",&num);
> }
> return 0;
> }
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator