//数字拆分 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; }

相关推荐

牛客网
牛客企业服务