为啥全是WA??求大佬QAQ
  • 板块题目总版
  • 楼主lvyichen5ban
  • 当前回复4
  • 已保存回复4
  • 发布时间2024/3/1 18:20
  • 上次更新2024/3/1 20:47:38
查看原帖
为啥全是WA??求大佬QAQ
999198
lvyichen5ban楼主2024/3/1 18:20
#include<bits/stdc++.h>
using namespace std;
int a[27];
int maxn=0,m;
string s;
int main()
{
	for(int i=1;i<=4;i++)
	{
		getline(cin,s);
		for(int j=1;j<=s.length();j++)
		{
			if(s[j]>='A'&&s[j]<='Z')
			{
				a[s[j]-'A'+1]++;
			}
		}
	}
	for(int i=1;i<=26;i++)
	{
		if(a[i]>maxn)
		{
			maxn=a[i];
		}
	}
	for(int i=maxn;i>=1;i--)
	{
		for(int j=1;j<=26;j++)
		{
			if(a[j]>=i)
			{
				cout<<"* ";
			}
			else 
			{
				cout<<"  ";
			}
		}
		cout<<endl;
	}
	for(int i=1;i<=26;i++)
	{
		cout<<char(i+'A'-1)<<" ";
	}
	return 0;	
}

谢谢~~~~

2024/3/1 18:20
加载中...