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

提交了好多次都是wrong answer.哪位好心指点?

Posted by 00448018 at 2005-02-28 21:45:31 on Problem 2136
#include<iostream.h>
int maximum(int a[],int b){
   int max = a[0];
   int i = 0;
   while((i + 1)<b){
	  if(a[i + 1]>max)
	  max = a[i + 1];
	  i++;
	}
	return max;
}
int a[26];
void main(){
   int i,j,k,r,d = 1;
   char input[4][72];
   for(i = 0;i < 4;i++){
	  cin.getline(input[i],72);
	  for(j = 0;j < 72;j++){
		 if(input[i][j] >= 'A'&&input[i][j] <= 'Z')
			a[input[i][j] - 'A']++;
			}
   }	
   k = maximum(a,26);
   for(d = 1;d <= k;d++){
	  for(r = 0;r < 25;r++){
	     if(d > (k-a[r]))
		    cout<<"* ";
		 else
			cout<<"  ";
		}
         if(d > (k-a[25]))
		    cout<<"*";
		 else
			cout<<" ";
         cout<<endl; 
	}
   cout<<"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";
}


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