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 |
请问高手:为什么输出的前面的数对,后面却都多2呢?还有time limit exceed怎么办?#include <stdio.h> #include <math.h> void main(){ int i,j,k,m,s[10000]={0},n[3]; for(i=1;i<10000;i++){ n[0]=n[1]=n[2]=0; j=i; for(k=0;k<3;k++){ n[k]=j%10; j=j/10; if(j==0) break; } m=i+n[0]+n[1]+n[2]; if(m<10000) s[m]--; } for(i=1;i<10000;i++){ if(s[i]==0) printf("%d\n",i); } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator