結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー villachvillach
提出日時 2017-09-17 17:24:04
言語 Java21
(openjdk 21)
結果
AC  
実行時間 125 ms / 5,000 ms
コード長 360 bytes
コンパイル時間 2,971 ms
コンパイル使用メモリ 74,400 KB
実行使用メモリ 54,436 KB
最終ジャッジ日時 2024-04-25 14:57:46
合計ジャッジ時間 6,609 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
54,232 KB
testcase_01 AC 113 ms
53,092 KB
testcase_02 AC 120 ms
54,156 KB
testcase_03 AC 118 ms
54,212 KB
testcase_04 AC 115 ms
53,980 KB
testcase_05 AC 118 ms
54,020 KB
testcase_06 AC 113 ms
54,160 KB
testcase_07 AC 107 ms
53,444 KB
testcase_08 AC 119 ms
54,076 KB
testcase_09 AC 119 ms
53,988 KB
testcase_10 AC 117 ms
53,904 KB
testcase_11 AC 118 ms
54,136 KB
testcase_12 AC 125 ms
53,836 KB
testcase_13 AC 116 ms
54,112 KB
testcase_14 AC 120 ms
54,028 KB
testcase_15 AC 120 ms
54,272 KB
testcase_16 AC 120 ms
54,096 KB
testcase_17 AC 121 ms
54,116 KB
testcase_18 AC 121 ms
54,196 KB
testcase_19 AC 119 ms
54,164 KB
testcase_20 AC 108 ms
52,984 KB
testcase_21 AC 121 ms
54,180 KB
testcase_22 AC 119 ms
54,436 KB
testcase_23 AC 114 ms
53,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.Scanner;
import java.math.*;

public class N47 {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		double l = Math.log(n) / Math.log(2);
		if(l % 1.0 == 0){
			System.out.println((int) Math.round(l));
		}else{
			System.out.println((int) Math.floor(l) + 1);
		}
	}
}
0