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 fangxubz at 2014-04-21 11:32:28 on Problem 1316
#include<stdio.h>
int main()
{
    int n, i, j;
    for(i = 1; i <=10000; i++)
    {
        int flag = 0;
        int sum;
        for(j = i - 36; j < i; j++)
        {
            int h = j;
            sum = j;
            while(h != 0)
            {
                sum += h%10;
                h /= 10;
            }
            if(sum == i)
            {
                flag = 1;
                break;
            }
        }
        if(flag == 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