20TLE求助
查看原帖
20TLE求助
334981
M1ngwang_233楼主2024/6/6 16:18
#include<bits/stdc++.h>
using namespace std;
int b[30];
int main(){
	char a='0';
	int maxx=-1; 
	for(int i=0;i<4;i++){
		a='0';
		for( ;a!='\n';){
			a=getchar();
			if(a>='A' and a<='Z'){
				b[a-'A']++;
			}
		}
	}
	for(int i=1;i<=26;i++)
		maxx=max(b[i],maxx);
	while(maxx>0){
		for(int j=0;j<26;j++){
			if(b[j]>=maxx){
				printf("* ");
			}
			else printf("  ");
		}
		maxx--;
		printf("\n");
	}
	printf("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");
}

搞不明白哪里慢了

2024/6/6 16:18
加载中...