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

水过100......很不爽为了过第100道题

Posted by yunyin at 2009-07-28 19:49:05 on Problem 2136
很不爽今天,做到99道题,很想拿一道经典题过100.
结果......那道BT的1835......做不下来,直接被转晕了......
结果做这道题......竟然差点下标答错......
不爽......
#include <iostream>
using namespace std;
int total[26]={0};
int main()
{
	char a[100];
	int max=0,i,j;
	for(i=0;i<4;i++)
	{
		gets(a);
		for(j=0;j<strlen(a);j++)
			if(a[j]>='A'&&a[j]<='Z')
			{
				total[a[j]-'A']++;
				if(total[a[j]-'A']>max) max=total[a[j]-'A'];
			}
	}
	while(1)
	{
		for(i=0;i<26;i++)
		{
			if(total[i]==max) { printf("*"); total[i]--; }
			else printf(" ");
			if(i!=25) printf(" ");
			else printf("\n");
		}
		max--;
		if(max==0)
			break;
	}
	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