林见清 level
获赞
3
粉丝
2
关注
14
看过 TA
158
门头沟学院
2025
Java
IP属地:重庆
暂未填写个人简介
私信
关注
0 点赞 评论 收藏
分享
2024-05-21 20:05
门头沟学院 Java
//小美的 MTimport java.util.Scanner;import java.util.ArrayList;import java.util.List;// 注意类名必须为 Main, 不要有任何 package xxx 信息public class Main {    public static void main(String[] args) {        Scanner sc = new Scanner(System.in);        int n = sc.nextInt();        int k = sc.nextInt();        List<Character> list = new ArrayList<>();        String s = sc.next();        int l = 0;        for (int i = 0; i < n; i++) {            char c = s.charAt(i);            if (c == 'M' || c == 'T') {                l++;            }        }        if (l + k > n) {            System.out.println(n);        } else {            System.out.println(l + k);        }    }}
投递美团等公司7个岗位
0 点赞 评论 收藏
分享

创作者周榜

更多
关注他的用户也关注了:
牛客网
牛客企业服务