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

这个是我的代码,结果跟题目中列出来的都一样,为什么wrong answer?请帮忙看下啊!谢谢!

Posted by softmind at 2006-04-02 21:05:46 on Problem 1316
#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();
    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