結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー Cavasiro
提出日時 2020-04-16 16:47:42
言語 Java
(openjdk 23)
結果
AC  
実行時間 138 ms / 5,000 ms
コード長 354 bytes
コンパイル時間 2,405 ms
コンパイル使用メモリ 74,440 KB
実行使用メモリ 54,764 KB
最終ジャッジ日時 2024-10-01 20:13:03
合計ジャッジ時間 6,435 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
 
class Main {
	int n;
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Main m = new Main(n);
		System.out.println(m.pocket(1));
	}
	Main(int n){
		this.n = n;
	}
	int pocket(int num){
		if(num*2<n){
			return 1 + pocket(num*2);
		} else {
			return num==1?0:1;
		}
	}
}
0