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

Re:如果按我的算法做,接下来要怎莫算阿

Posted by atyuwen at 2008-04-12 11:01:27 on Problem 1019
In Reply To:如果按我的算法做,接下来要怎莫算阿 Posted by:ch_619999 at 2007-09-24 13:43:15
这样会超时的......
> #include<iostream>
> using namespace std;
> int main()
> {
>     int n;
>     long long int s,i,j,a;
>     cin>>n;
>     for(i=0;i<n;i++)
>     {
>         s=0;
>         cin>>a;j=1;
>         while(1)
>         {
>            
>            s+=j;
>            if(j>=10&&j<100)
>            s+=j-10+1;
>            if(j>=100&&j<1000)
>            s+=100+2*(j-100+1);
>            if(j>=1000&&j<10000)
>            s+=1000+2*(j-1000+1);
>            if(j>=10000&&j<100000)
>            s+=10000+2*(j-10000+1);
>            if(s>=a)
>            break;
>            j++;
>               
>         }
>        // ????????????????
>     }
>     system("PAUSE");
>     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