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

Re:太失败了,这么简单的题居然交了13次才通过。

Posted by luketyg at 2009-01-11 19:30:51 on Problem 1152
In Reply To:Re:太失败了,这么简单的题居然交了13次才通过。 Posted by:asanasdake at 2007-09-02 21:57:28
对的吗??看看下面的··就是错的??
#include<stdio.h>
void main()
{
	char c[3000];
	while(scanf("%s",c)!=EOF)
	{
		int sum=0;
		int max=2,len=0,i,d[3000];
		while(c[len]!='\0')
		{
			if(c[len]>='0'&&c[len]<='9')d[len]=c[len]-'0';
			if(c[len]>='A'&&c[len]<='Z')d[len]=c[len]-'A'+10;
			if(c[len]>='a'&&c[len]<='z')d[len]=c[len]-'a'+36;
			if(d[len]>=max)max=d[len];
			sum+=d[len];
			len++;
		}
		for(i=max;i<=62;i++)
		{
			if(sum%(i-1)==0)
			{
				printf("%d\n",i);
				break;
			}
		}
		if(i>62)
			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