求大佬帮忙看看模拟哪里出问题了
查看原帖
求大佬帮忙看看模拟哪里出问题了
570842
FPXS11GO楼主2022/9/27 09:59

注意到了行末不输出空格,但还是G了

#include<bits/stdc++.h>
using namespace std;
int a[27];
char s[102];
int main(){
	int maxn=0,n=0;
	for(int i=0;i<4;i++)
	{	gets(s);
		 //scanf("%s",s);
		n=strlen(s);
		for(int j=0;j<n;j++)
			if(s[j]>='A'&&s[j]<='Z')a[s[j]-'A']++;
		}
	for(int i=0;i<26;i++)maxn=max(maxn,a[i]);
	for(int i=maxn;i>0;i--)
	{
		for(int j=0;j<26;j++)
			{
			if(j=25)
				{
				if(a[j]==i)
				{
				cout<<"*";
				a[j]--;
				}
				else cout<<" ";
			}
			if(j<25){
			if(a[j]==i)
			{
			cout<<"* ";
			a[j]--;
			}
			else cout<<"  ";
			
			}
		}
		cout<<endl;
	}
	for(int k=0;k<26;k++)printf("%c ",k+'A');
	return 0;
} 
2022/9/27 09:59
加载中...