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 whus2010301500230 at 2011-10-28 23:26:14 on Problem 1316
/*
Poj: 1316 Self Numbers
*/

#include <stdio.h>

int main() 
{
    int num[10001];
    int i, j;
    int d;
    
    for(i = 0; i < 10001; i++)
        num[i] = 0;
    
    for(i = 0; i < 10000; i++) {
        j = i;
        d = i;
        while(j) {
            d += j%10;
            j /= 10;
        }
        if(d <= 10000)
            num[d] = 1;
    }
    
    for(i = 0; i < 10001; i++)
        if(num[i] == 0)
            printf("%d\n", i);
            
    return 0;
}

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