| ||||||||||
| 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 | |||||||||
Why always Runtime Error???请大牛们,大侠们不吝赐教!!#include<iostream>
#include<cmath>
#include<iostream>
using namespace std;
int main()
{
int a,n,k,b,j,c,num[50000],i=1,u;
cin>>n;
while(n>0)
{
cin>>a;b=a;
for(k=0;b>0;b/=10,k++);//计算是a几位数
b=a%(int)pow(10,k-1);c=5;
for(j=k-2;j>=1;j--)c+=4*pow(10,j);//是444..45
if(b>=c)a+=pow(10,k-1);
a/=pow(10,k-1);//只保留a的最高位
a*=pow(10,k-1);num[i]=a;
n--;i++;
}
for(u=1;u<i;u++)cout<<num[u]<<endl;
return 1;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator