网易雷火第二题投机取巧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 */ }
点赞 评论

相关推荐

不愿透露姓名的神秘牛友
07-22 11:33
点赞 评论 收藏
分享
快点约我面试吧
投递百度等公司10个岗位
点赞 评论 收藏
分享
程序员小白条:你是沟通了900个,不是投了900份简历,你能投900份,意味着对面都要回复你900次,你早就找到实习了,没亮点就是这样的,别局限地区,时间投的也要早,现在都要7月了
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务