結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー mustonmuston
提出日時 2016-05-18 16:43:47
言語 Java21
(openjdk 21)
結果
AC  
実行時間 131 ms / 5,000 ms
コード長 497 bytes
コンパイル時間 1,994 ms
コンパイル使用メモリ 74,324 KB
実行使用メモリ 41,656 KB
最終ジャッジ日時 2024-04-15 22:54:58
合計ジャッジ時間 5,866 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
40,652 KB
testcase_01 AC 112 ms
39,848 KB
testcase_02 AC 130 ms
40,888 KB
testcase_03 AC 127 ms
41,656 KB
testcase_04 AC 114 ms
40,116 KB
testcase_05 AC 127 ms
41,376 KB
testcase_06 AC 126 ms
41,148 KB
testcase_07 AC 126 ms
41,204 KB
testcase_08 AC 114 ms
39,800 KB
testcase_09 AC 126 ms
41,072 KB
testcase_10 AC 114 ms
39,896 KB
testcase_11 AC 129 ms
41,108 KB
testcase_12 AC 131 ms
41,196 KB
testcase_13 AC 129 ms
41,132 KB
testcase_14 AC 127 ms
41,084 KB
testcase_15 AC 130 ms
41,048 KB
testcase_16 AC 129 ms
41,128 KB
testcase_17 AC 128 ms
41,268 KB
testcase_18 AC 113 ms
39,892 KB
testcase_19 AC 127 ms
41,168 KB
testcase_20 AC 128 ms
41,292 KB
testcase_21 AC 130 ms
41,456 KB
testcase_22 AC 127 ms
41,204 KB
testcase_23 AC 130 ms
41,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
/*yukicoder No.47 ポケットを叩くとビスケットが2倍*/
class No47{
  public static void main(String[] args){
    Scanner scan=new Scanner(System.in);
    int n = scan.nextInt();  //食べたいクッキーの枚数
    int cookie = 1;  //今のクッキーの枚数
    int hit = 0;  //叩いた回数
    //食べたい量までクッキーを増やす
    while(cookie<n){
      hit++;
      cookie *= 2;
    }
    System.out.println(hit);
  }
}
0