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 anyl94xh at 2011-10-17 13:15:01 on Problem 2136
#include<cstdio>
#include<cctype>
int cnt[27];
int main()
{
	char c;
	int max=0,cur;
	while((c=getchar())!=EOF)
	{
		if(!isalpha(c)) continue;
		cnt[c-'A']++;
	}
	for(int i=0;i<26;i++) if(cnt[i]>max) max=cnt[i];
	while(max--)
	{
		cur=25;
		while(cnt[cur]<=max) cur--;
		for(int i=0;i<cur;i++)
		   if(cnt[i]>max) printf("* ");
		   else printf("  ");
		printf("*\n");
	}
	printf("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\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