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

诚向高手请教!!

Posted by wanpi0user at 2005-05-10 23:20:43 on Problem 1715
Why??
请问谁能提供帮助!以下程序我自己测试过,没问题。可提交结果不容乐观。
//458823 wanpi0user 1715 Runtime Error     C++ 0.78K 2005-05-10 23:16:53 
#include<stdio.h>
int main(){
	int a[16],j,m,i,ii,t,k;
	int b[8][9]={{648648000,32432400,2162160,154440,11880,990,90,9,1},
	{54054000,3603600,240240,17160,1320,110,10,1},
	{5405400,360360,24024,1716,132,11,1},
	{491400,32760,2184,156,12,1},
	{40950,2730,182,13,1},
	{3150,210,14,1},
	{225,15,1},
	{16,1}};
	while(1){
		for(i=0;i<16;i++){a[i]=15-i;}
		scanf("%d",&m);if(m<1||m>708643126) break;
		if(m==708643126) {printf("0\n");continue;}
		ii=0;
		while(ii<8) {
			if(m<b[ii][0])break;
			else{m-=b[ii][0];++ii;}
		}
		if(ii==8) break;
		--m;
		i=1;
		while(i<(9-ii)){
			t=m/b[ii][i];k=0;j=0;
			while(a[j]==20) j++;
			while(k++<t){
				while(a[++j]==20);
			}
			printf("%X",a[j]);
			a[j]=20;
			m%=b[ii][i];
			i++;
		}
		printf("\n");
	}
	return 0;
}
//////////////////

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