| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
WA,怎么回事啊TAT代码如下,是2136
#include <iostream>
#include<string>
#include<cstring>
using namespace std;
int letter[26];
int main()
{
memset(letter,0,sizeof(letter));
for(int i = 0;i<4;i++)
{
string str;
getline(cin,str);
for(int j = 0;j<str.length();j++)
{
if( (str[j]-'A'>=0)&&(str[j]-'A'<=25) )
letter[str[j]-'A']++;
}
}
int maxl = 0;
for(int i = 0;i<26;i++)
{
maxl = max(maxl,letter[i]);
}
for(int i = 0;i<maxl;i++)
{
for(int j = 0;j<26;j++)
{
if(letter[j]-maxl<0)
{
letter[j]++;
cout<<" ";
}
else
{
cout<<"*";
int judge = 0;
for(int t = j+1;t<26;t++)
if(letter[t]-maxl>=0)
judge = 1;
if(judge = 0){
cout<<endl;
break;
}
}
if(j!=25) cout<<" ";
}
cout<<endl;
}
cout<<"A B C D E F J H I J K L M N O P Q R S T U V W X Y Z"<<endl;
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator