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 |
开始理解错题啦,如下打个32000的表就一次ac啦,0MSlong long j,a[32001],s[32001]; int i,k; //打出数列到n共有多少位数 a[1]=1; s[1]=1; for(i=2;i<=32000;i++) { if(i<10) a[i]=a[i-1]+1; else if(i>=10&&i<100) a[i]=a[i-1]+2; else if(i>=100&&i<1000) a[i]=a[i-1]+3; else if(i>=1000&&i<10000) a[i]=a[i-1]+4; else a[i]=a[i-1]+5; s[i]=s[i-1]+a[i]; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator