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 langx at 2010-10-14 00:29:28 on Problem 2136
#include <iostream>
#include <cstdlib>
using namespace std;

char ch, map[290][53];
int i, j, maxc, cnt[26];

int main(){
	for( i = 0; i < 4; ++i ){
		while ( (ch = getchar()) != '\n' ) {
			if(ch >= 'A' && ch <= 'Z') ++cnt[ch - 'A'];
		}
	}
	memset(map,' ',sizeof(map));
	maxc = 0;
	for ( i = 0; i < 26; ++i ) {
		if(cnt[i] > maxc) maxc = cnt[i];
		for ( j = 0; j < cnt[i]; ++j) {
			map[j][i << 1] = '*';
		}
	}
	for ( i = 0; i < maxc; ++i ) {
		map[i][52] = '\0';
	}
	if(maxc){
		for ( i = maxc - 1; i >= 0; --i  ) {
			printf("%s\n",map[i]);
		}
	}
	for ( i = 0; i < 26; ++i ) {
		printf("%c ",i + 'A');
	}
	printf("\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