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

这样都超时,天理何在????My code following:::

Posted by knuthocean at 2005-03-19 00:32:39 on Problem 1152
#include <stdio.h>
#include <string.h>

int translate(char c)
{
	int d;
	if(c>='0'&&c<='9')
		d=c-'0';
	else if(c>='A'&&c<='Z')
		d=c-'A'+10;
	else if(c>='a'&&c<='z')
		d=c-'a'+36;
	return d;
}

void main()
{
	char input[200],c;
	int i,j,min,n,len;
	while(scanf("%s",&input)==1){
		c=input[0];
		for(i=1;input[i]!='\0';i++){
			if(c<input[i])
				c=input[i];
		}
		len=i;
		min=translate(c);
		min++;
		min=(min<2)?2:min;
		int num;
        num=0;
		for(j=0;j<len;j++)
		num+=translate(input[j]);


		for(n=min;n<=62;n++){

			if(num%(n-1)==0){
				printf("%d\n",n);
				break;
			}
		}
		if(n==63)
			printf("such number is impossible!\n");
	}
}

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