4 条题解

  • 0
    @ 2025-11-23 11:44:23
    #include <iostream>
    #include <string>
    
    using namespace std;
    
    int main()
    {   
        string str;
        getline(cin,str);
        int count[26] = {0};
    
        for(char ch : str)  count[ch - 'a']++;
    
        int maxIndex = 0;
        for(int i = 0; i < 26; i++)
        {
            if(count[i] > count[maxIndex])
            {
                maxIndex = i;
            }
        }
    
        char maxChar = 'a' + maxIndex;
        cout << maxChar;
    
        return 0;
    }
    
    • 0
      @ 2025-10-27 22:44:28
      #include<stdio.h>
      #include<string.h>
      
      int main(){
      	
      	char str[105];
      	
      	fgets(str,105,stdin);
      	str[strcspn(str,"\n")]=0;
      	
      	int tot[26]={0};
      	for(int i=0;i<strlen(str);i++){
      		tot[str[i]-97]++;
      	}
      	int max=0;
      	char s;
      	for(int i=0;i<26;i++){
      		if(tot[i]>max){
      			max=tot[i];
      			s=i+97;
      		}
      	}
      	printf("%c",s);
      	
      	return 0;
      	
      }
      
      • 0
        @ 2024-11-5 11:26:54

        #include<bits/stdc++.h> using namespace std; int main() { string str;

        cin>>str;
        
        int l=str.size();
        
        int ans[1024]={0};
        
        for(int i=0; i<=l-1; i++)
        {
        	int x=(int)str[i];
        	ans[x]++;
        }
        
        int max=0;
        int step;
        
        for(int i=95; i<=125; i++)
        {
        	if(ans[i]>max)
        	{
        		max=ans[i];
        		step=i;
        	}
        }
        
        char result=(char)step;
        
        cout<<result;
        
        return 0;
        

        }

        • -1
          @ 2025-10-13 22:46:00

          //(注这是一种错误方法过不了哈,别复制) 为什么这种方法过不了啊,想了三个小时才写出来,因为输入调用了30遍系统,变得贼慢,心态崩溃了,那个死豆包还一直说我错,说着说着发现是自己错了,deepseek还靠谱点,气死,找不到人吐槽了,在这发发牢骚吧 #include<stdio.h>

          int main() { int a[26]; int asd=0 for(int i=0;i<26;i++) a[i]=(i+1)*100; char mop[31]; scanf("%31s",mop); char c; while(c=mop[asd])&&c!='\n') { a[c-97]++; asd++; } for(int i=0;i<25;i++) { int m; if(a[i]%100>a[i+1]%100) { m=a[i]; a[i]=a[i+1]; a[i+1]=m; } } printf("%c",(a[25]/100)+96);

          }

          • 1

          信息

          ID
          182
          时间
          1000ms
          内存
          256MiB
          难度
          5
          标签
          递交数
          574
          已通过
          210
          上传者