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 1040769630 at 2011-07-28 10:26:40 on Problem 3077
#include<stdio.h>
main()
{
    long a;
    int n;
    scanf("%d",&n);
    while(n--)
    {
        scanf("%ld",&a);
        if(a<10)
        printf("%ld\n",a);
        else if(a<100)
        {
            if(a%10>4)
            printf("%ld\n",(a/10+1)*10);
            else
            printf("%ld\n",a/10*10);
        }
        else if(a<1000)
        {
            if(a%100>44)
            printf("%ld\n",(a/100+1)*100);
            else
            printf("%ld\n",a/100*100);
        }
        else if(a<10000)
        {
            if(a%1000>444)
            printf("%ld\n",(a/1000+1)*1000);
            else
            printf("ld\n",a/1000*1000);
        }
        else if(a<100000)
        {
            if(a%10000>4444)
            printf("%ld\n",(a/10000+1)*10000);
            else
            printf("%ld\n",a/10000*10000);
        }
        else if(a<1000000)
        {
            if(a%100000>44444)
            printf("%ld\n",(a/100000+1)*100000);
            else
            printf("%ld\n",a/100000*100000);
        }
        else if(a<10000000)
        {
            if(a%1000000>444444)
            printf("%ld\n",(a/1000000+1)*1000000);
            else
            printf("%ld\n",a/1000000*1000000);
        }
        else
        {
            if(a%10000000>4444444)
            printf("%ld\n",(a/10000000+1)*10000000);
            else
            printf("%ld\n",a/10000000*10000000);
        }
    }
}

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