第十四届蓝桥杯 三十天刷题 第十六天

浅夜呀 2023-03-19 22:49:05

嘿嘿嘿 今天放个假 和女朋友出去玩了,回来不早了,先发个打卡帖子,题解博客明天补哈

英文字母

import java.util.Scanner;

/**
 * @ClassName 英文字母
 * @Author @浅夜
 * @Date 2023/3/19 22:41
 * @Version 1.0
 */

public class 英文字母 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        System.out.println((char)(n + 64));
    }
}

 单词分析

import java.util.Scanner;

public class Main {
    static int[] cnt = new int[26];
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        for (int i = 0; i <s.length() ; i++) {
            char c = s.charAt(i);
            cnt[c-'a']++;
        }
        int max= 0;
        char c = ' ';
        for (int i = 0; i <26 ; i++) {
            if(max<cnt[i]){
                max=cnt[i];
                c=(char)(i+'a');
            }
        }
        System.out.println(c);
        System.out.print(max);
    }
}

 

...全文
6 回复 打赏 收藏 转发到动态 举报
写回复
回复
切换为时间正序
请发表友善的回复…
发表回复

49,437

社区成员

发帖
与我相关
我的任务
社区描述
和众多高校算法内卷分子,一起学习和交流算法那。浓郁的算法交流氛围,拒绝躺平,有效内卷。加入我们,私信我拉你入核心内卷群。
算法数据结构leetcode 个人社区
社区管理员
  • 执 梗
  • Dream-Y.ocean
  • ღCauchyོꦿ࿐
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

 刷题!