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

多了一条语句

Posted by NobleQiao at 2006-07-15 23:26:18 on Problem 1316
In Reply To:这个是我的代码,结果跟题目中列出来的都一样,为什么wrong answer?请帮忙看下啊!谢谢! Posted by:softmind at 2006-04-02 21:05:46
> #include <stdio.h>
> #include <string.h>
> #define lenth 10003
> 
> int selfnum[lenth]={0};
> void done();
> 
> int main()
> {
>     done();
>     for(int i=1;i<10000;i++)
>     {
>         if(selfnum[i]==0)
>             printf("%d\n",i);
>         else
>             continue;
>         }
>         //getchar(); //here changed
>     return 0;
>     }
>     
> void done()
> {
>     int sum,yu;
>     selfnum[0]=1;
>     selfnum[1]=0;
>     selfnum[2]=1;
>     for(int i=2;i<lenth;i++)
>     {
>         yu=i;
>         sum=yu;
>         while(yu)
>         {
>             sum+=(yu%10);
>             yu/=10;
>             }            
>         selfnum[sum]=1;              
>         }    
>     }

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