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

AC 了的,,请看

Posted by drownever at 2006-12-18 19:52:12 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;
     }
    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=i;
        while(yu)
        {
            sum+=(yu%10);
            yu/=10;
        }
		if(sum<lenth)
        selfnum[sum]=1;
		else continue;
     }    
}


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