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:仔细看题目。输出是有空格隔开的

Posted by 00448133 at 2005-02-27 14:00:16 on Problem 2136
In Reply To:仔细看题目。输出是有空格隔开的 Posted by:hawk at 2004-12-07 18:52:40
但是即使这样也不行啊。我还特意把最后一个空格去掉但也不行
#include<iostream.h>
#include<iomanip.h>
void main(){
	char letter[4][73];
	int sum[26];
	for(int i=0;i<26;i++)
		sum[i]=0;
	int height=0;
	for( i=0; i<4; i++){
		cin.getline(letter[i],72);
		for(int k=0;k<72;k++){
			if(letter[i][k]>='A'&&letter[i][k]<='Z'){
				sum[letter[i][k]-'A']++;
				if(sum[letter[i][k]-'A']>height)
					height=sum[letter[i][k]-'A'];
				
			}
			
			//else if(letter[i][k]=='\n')
			//	break;
		}
	}
	for(i=height;i>0;i--){
		for(int k=0;k<25;k++){
			if(sum[k]==i){
				cout<<"* ";
				sum[k]--;
			}
			else
				cout<<"  ";
		}
		if(sum[25]==i){
			cout<<"*";
			sum[25]--;
		}
		else 
			cout<<" ";
		cout<<"\n";
	}
	for(i=0;i<25;i++)
		cout<<char('A'+i)<<" ";
	cout<<"Z"<<"\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