| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
如果按我的算法做,接下来要怎莫算阿#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator