//数字拆分 public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); long[] res = new long[t]; for (int i = 0; i < t; i++) { long n = sc.nextInt(); res[i] = method(n); } sc.close(); for (int i = 0; i < t; i++) { System.out.println(res[i]); } } public static long method(long n) { int res = 1; if (n == 1) { return 1; } while (n >= Math.pow(2, res)) { res++; } return res; }

相关推荐

北冥有鱼吗:工作忙,现在没工作了哈哈哈
点赞 评论 收藏
分享
09-27 00:29
东北大学 Java
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
昨天 10:39
点赞 评论 收藏
分享
牛客网
牛客企业服务