5 条题解

  • 4
    @ 2024-11-15 18:40:01
    #include <stdio.h>
    #include <iostream>
    #include <string.h>
    using namespace std;
    char a[100000];
    int num[30];
    int main()
    {
    	int maxx = 0;
    	for(int i = 0 ; i < 4 ; i++)
    	{
    		cin.getline(a,100000);
    		int len = strlen(a);
    		for(int j =0  ;j < len ;j++)
    		{
    			if(a[j] >='A' && a[j]<='Z')
    			{
    				num[ a[j] - 64 ]++;
    				maxx = max(maxx , num[ a[j] - 64 ]);
    			}
    		}
    	}
    	for(int i = maxx ; i >= 1 ; i--)
    	{
    		for(int j = 1; j <= 26 ; j++)
    		{
    			if(num[j] >= i)
    				cout <<"*";
    			else 
    				cout <<" ";
    			cout << " ";
    		}
    		cout << endl;
    	}
    	for(int i = 1 ; i <= 26;i++)
    		cout << (char)(i + 64) << " ";
    } 
    
    
    • 2
      @ 2025-12-14 13:47:42
      #include<bits/stdc++.h>
      using namespace std;
      const int in=1e5+10;
      const int inf=0x3f3f3f3f;
      #define LL long long
      LL n,maxn=-inf,y;
      LL s[30];
      string a;
      int main()
      {
      	ios::sync_with_stdio(0);
      	cin.tie(0);
      	for(int i=1;i<=4;i++)
      	{
      		getline(cin,a);
      		for(int j=0;j<a.size();j++)
      		{
      			if(a[j]>='A'&&a[j]<='Z')
      			{
      				s[a[j]-64]++;
      				maxn=max(maxn,s[a[j]-64]);
      			}
      		}
      	}
      	for(int i=1;i<=maxn;i++)
      	{
      		for(int j=1;j<=26;j++)
      		{
      			if(s[j]>=maxn-i+1)cout<<"* ";
      			else cout<<"  ";
      		}
      		cout<<endl;
      	}
      	for(int i=65;i<=90;i++)cout<<char(i)<<" ";
      	return 0;
      }
      
      • 1
        @ 2026-1-16 22:01:21
        #include<bits/stdc++.h>
        using namespace std;
        const int N=1e3+10;
        int sum=-999;
        int a[26];
        int main()
        {
            string b;
            for(int i=0;i<4;i++){
            	getline(cin,b);
                for(int i=0;i<b.size();i++){
            	    if(!(b[i]>='A'&&b[i]<='Z'))
            	        continue;
            	    a[b[i]-65]+=1;
        	    }
            }
            for(int i=0;i<26;i++){
            	if(a[i]>=sum)
            	    sum=a[i];
        	}
        	for(int i=sum;i>0;i--){
        		for(int j=0;j<26;j++){
        			if(a[j]>=i)
        			    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";
        	return 0;
        }
        
        • 1
          @ 2022-1-25 9:47:47
          #include <iostream>
          #include <string.h>
          using namespace std;
          char a[105];
          int num[105];
          int main()
          {
          	for(int i=0;i<4;i++)
          	{
          		cin.getline(a,105);
          		int len=strlen(a);
          		for(int j=0;j<len;j++)
          		{
          			num[a[j]]++;
          		}
          		if(a[i] >='A'&&a[i]<='Z')
          			num[a[i] - 'A' + 1]++;
          	}
          	int maxx=0;
          	for(int i=65;i<=90;i++)
          	{
          		maxx=max(num[i],maxx);
          	}
          	for(int i=maxx;i>=1;i--)
          	{
          		for(int j=65;j<=90;j++)
          		{
          			if(num[j]>=i)
          			{
          				cout<<"*";
          			}
          			else
          			{
          				cout<<" ";
          			}
          			cout<<" ";
          		}
          		cout<<endl;
          	}
          	for(int i=65;i<=90;i++)
          	{
          		cout<<(char)(i)<<" ";
          	}
          	return 0;
          }
          
          • 0
            @ 2023-6-4 19:26:09
            #include <bits/stdc++.h>
            using namespace std;
            char a[114514];
            int maxx = 0 - INT_MAX,letter_cnt[28]; 
            signed main(){
            	for(int i = 1;i <= 4;i++){
            		cin.getline(a,114514);
            		for(int i = 0;i < strlen(a);i++){
            			if(a[i] >= 'A' and a[i] <='Z') letter_cnt[a[i] - 65]++;
            		}
            	}
            	for(int i = 0;i < 26;i++){
            		maxx = max(maxx,letter_cnt[i]);
            	}
            	for(int i = maxx;i >= 1;i--){
            		for(int j = 0;j < 26;j++){
            			if(letter_cnt[j] >= i) cout << "*";
            			else cout << " ";
            			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";
            }
            
            • 1

            信息

            ID
            1088
            时间
            1000ms
            内存
            128MiB
            难度
            5
            标签
            递交数
            436
            已通过
            171
            上传者