結果

問題 No.1010 折って重ねて
ユーザー htensai
提出日時 2020-03-25 10:26:46
言語 Java
(openjdk 23)
結果
AC  
実行時間 120 ms / 2,000 ms
コード長 556 bytes
コンパイル時間 2,283 ms
コンパイル使用メモリ 76,972 KB
実行使用メモリ 54,536 KB
最終ジャッジ日時 2025-01-01 20:00:48
合計ジャッジ時間 8,638 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double x = sc.nextInt() * 1000.0;
        double y = sc.nextInt() * 1000.0;
        double h = sc.nextInt();
        int count = 0;
        while (x > h || y > h) {
            count++;
            if (x > h && (y <= h || x <= y)) {
                x /= 2;
                h *= 2;
            } else {
                y /= 2;
                h *= 2;
            }
        }
        System.out.println(count);
    }
}
0