結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー takeya_okinotakeya_okino
提出日時 2017-06-12 10:56:33
言語 Java21
(openjdk 21)
結果
AC  
実行時間 126 ms / 5,000 ms
コード長 319 bytes
コンパイル時間 1,854 ms
コンパイル使用メモリ 74,056 KB
実行使用メモリ 57,448 KB
最終ジャッジ日時 2023-10-24 21:30:49
合計ジャッジ時間 5,512 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
56,264 KB
testcase_01 AC 126 ms
57,272 KB
testcase_02 AC 120 ms
57,272 KB
testcase_03 AC 108 ms
56,144 KB
testcase_04 AC 117 ms
57,136 KB
testcase_05 AC 108 ms
56,220 KB
testcase_06 AC 119 ms
57,424 KB
testcase_07 AC 118 ms
57,444 KB
testcase_08 AC 120 ms
57,360 KB
testcase_09 AC 121 ms
57,396 KB
testcase_10 AC 122 ms
57,440 KB
testcase_11 AC 109 ms
56,216 KB
testcase_12 AC 122 ms
57,432 KB
testcase_13 AC 114 ms
54,772 KB
testcase_14 AC 123 ms
57,448 KB
testcase_15 AC 119 ms
57,204 KB
testcase_16 AC 118 ms
57,244 KB
testcase_17 AC 115 ms
55,600 KB
testcase_18 AC 108 ms
56,124 KB
testcase_19 AC 119 ms
57,432 KB
testcase_20 AC 110 ms
56,152 KB
testcase_21 AC 121 ms
57,412 KB
testcase_22 AC 120 ms
55,344 KB
testcase_23 AC 110 ms
55,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int ans = 0;
    for(int i = 0; i < 30; i++) {
      if(N <= (int)Math.pow(2, i)) {
        ans = i;
        break;
      }
    }
    System.out.println(ans);
  }
}
0