結果

問題 No.598 オーバーフローファンタジー
ユーザー YamaKasa
提出日時 2018-09-26 15:03:35
言語 Java
(openjdk 23)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 442 bytes
コンパイル時間 3,020 ms
コンパイル使用メモリ 73,888 KB
実行使用メモリ 41,248 KB
最終ジャッジ日時 2024-10-10 20:44:20
合計ジャッジ時間 8,345 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int X = scan.nextInt();
		int A = scan.nextInt();
		int B = scan.nextInt();
		scan.close();
		long max = (long)Math.pow(2, N - 1);
		int t1 = (int)Math.ceil((double)X / A);
		int t2 = (int)Math.ceil(((double)max - X) / B);
		int ans = Math.min(t1, t2);
		System.out.println(ans);
	}
}
0