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 |
Re:Why always Runtime Error???请大牛们,大侠们不吝赐教!!In Reply To:Why always Runtime Error???请大牛们,大侠们不吝赐教!! Posted by:2006011320 at 2007-02-23 17:15:24 > #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; > } num这个数组比较大,必须定义为全局变量。。。 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator