美团2024年春招第一场笔试【技术】
//小美的 MT
import 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);
}
}
}
import 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);
}
}
}
全部评论
相关推荐
牛客28967172...:50w的包已经很高了,哪怕按16薪都是月3w多在后端里算ssp了。
无脑京东,阿里云羚羊那个是内包不推荐,虾皮food是仅次于供应链的烂部门,裁应届非常严重 点赞 评论 收藏
分享
10-24 19:59
门头沟学院 Java 点赞 评论 收藏
分享
10-04 11:53
商洛学院 后端工程师
赛博小保安:你这简历没啥大问题的,经历技能也足够了,问题应该就是出在出身了,学院本就是这样,HR忙着跟92的勾搭呢,哪有心思看我们这些双非😿😭 点赞 评论 收藏
分享

联想公司福利 1548人发布