网易雷火第二题投机取巧AC60% import java.util.Scanner; public class Main2 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String[] strings = sc.nextLine().split(","); System.out.println(find(strings)); } private static int find(String[] strings) { int count = 0; for (int i = 0; i < strings[0].length(); i++) { if (strings[0].charAt(i) == '3') count ++; } if (count > 7) return 15; else if(count < 3) { return 8; } else if(count == 4) { return 9; } else if(count == 5) { return 10; } return 11; } /* * 8 10% * 9 10% * 10 10% * 11 20% * 12 10% * 13 10% * 14 10% * 15 20% * 所有测试函数的字符串的位数为16 */ }
点赞 评论

相关推荐

2025-12-18 14:15
已编辑
哈尔滨工程大学 前端工程师
牛客87317764...:最近没啥hc,做好心灰意冷的准备。另外,大概率只有字节给你面试,最好别作为处女面
实习简历求拷打
点赞 评论 收藏
分享
01-14 16:23
广州商学院 Java
双非后端失败第N人:如果准备好了可以直接投字节,字节是最不看学历的,只要想面,大概率都能给你约面。
双非有机会进大厂吗
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务