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

无限PE?求解释。

Posted by happy__ting at 2010-05-30 18:53:07 on Problem 2136
#include<iostream>
using namespace std;
char a[75];
char b[75];
char c[75];
char d[75];
int result[26];
char *alpha="A B C D E F G H I J K L M N O P Q R S T U V W X Y Z";
int main()
{
	int i,max;
	memset(result,0,sizeof(result));
	gets(a);
	gets(b);
	gets(c);
	gets(d);
	for(i=0;a[i]!='\0';i++)
		if(a[i]!=' ')
			result[a[i]-'A']++;
	for(i=0;b[i]!='\0';i++)
		if(b[i]!=' ')
			result[b[i]-'A']++;
	for(i=0;c[i]!='\0';i++)
		if(c[i]!=' ')
			result[c[i]-'A']++;
	for(i=0;d[i]!='\0';i++)
		if(d[i]!=' ')
			result[d[i]-'A']++;
	for(i=0,max=0;i<26;i++)
		if(result[i]>max)
			max=result[i];
	for(;max>0;max--)
	{
		for(i=0;i<=25;i++)
		{
			if(result[i]>=max)
				printf("*");
			else
				printf(" ");
			if(i!=25)
				printf(" ");
		}
			printf("\n");
	}
	puts(alpha);
	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