結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー kazapyon27kazapyon27
提出日時 2017-05-08 23:40:43
言語 Java21
(openjdk 21)
結果
AC  
実行時間 134 ms / 5,000 ms
コード長 432 bytes
コンパイル時間 3,355 ms
コンパイル使用メモリ 72,604 KB
実行使用メモリ 56,164 KB
最終ジャッジ日時 2023-10-12 19:12:29
合計ジャッジ時間 7,857 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
55,784 KB
testcase_01 AC 128 ms
56,024 KB
testcase_02 AC 127 ms
55,972 KB
testcase_03 AC 128 ms
55,932 KB
testcase_04 AC 127 ms
55,872 KB
testcase_05 AC 127 ms
55,940 KB
testcase_06 AC 128 ms
55,728 KB
testcase_07 AC 127 ms
55,788 KB
testcase_08 AC 129 ms
56,008 KB
testcase_09 AC 127 ms
54,296 KB
testcase_10 AC 127 ms
55,476 KB
testcase_11 AC 126 ms
56,120 KB
testcase_12 AC 127 ms
55,996 KB
testcase_13 AC 127 ms
55,656 KB
testcase_14 AC 126 ms
55,796 KB
testcase_15 AC 126 ms
55,624 KB
testcase_16 AC 126 ms
56,036 KB
testcase_17 AC 126 ms
55,732 KB
testcase_18 AC 127 ms
56,164 KB
testcase_19 AC 128 ms
55,772 KB
testcase_20 AC 134 ms
55,500 KB
testcase_21 AC 127 ms
55,500 KB
testcase_22 AC 128 ms
55,864 KB
testcase_23 AC 127 ms
55,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/*No.47 ポケットを叩くとビスケットが2倍*/
import java.util.*;
public class No47 {
	public static void main(String[] args) {
		try(Scanner input = new Scanner((System.in))){
			int want_eat=input.nextInt(),clap=0,work=want_eat;
			while(work>=2){
				work/=2;
				clap++;
			}
			if(want_eat!=Math.pow(2, clap)){
				clap++;
			}
			System.out.println(clap);
		}catch(Exception e){
			e.printStackTrace();
		}		
	}
}
0