Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

请问高手:为什么输出的前面的数对,后面却都多2呢?还有time limit exceed怎么办?

Posted by 870817 at 2005-12-29 13:39:57 on Problem 1316
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator