美团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);
}
}
}
全部评论
相关推荐
点赞 评论 收藏
分享
点赞 评论 收藏
分享
01-08 09:52
门头沟学院 Java christina2...:楼主你应该问毕业前什么时候能签三方,签三方就代表着给你预留了这个岗位,毕业后直接正式入职。转正答辩拿到正式offer一般都是会签三方的,图片这个HR好像没有三方的概念。
点赞 评论 收藏
分享