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.h> int main(){ bool nn[10000]; int i,j; for(i=1;i<10000;i++){ if(i>=1000) j=i+i%10+(i/10)%10+(i/100)%10+(i/1000)%10; else if(i>=100) j=i+(i/100)%10+(i/10)%10+i%10; else if(i>=10) j=i+(i/10)%10+i%10; else j=i+i; nn[j]=0; } for(j=1;j<10000;j++) if(nn[j]) cout<<j<<endl; return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator