結果

問題 No.1010 折って重ねて
ユーザー tenten
提出日時 2020-12-01 10:05:01
言語 Java
(openjdk 23)
結果
AC  
実行時間 135 ms / 2,000 ms
コード長 719 bytes
コンパイル時間 2,026 ms
コンパイル使用メモリ 74,480 KB
実行使用メモリ 54,580 KB
最終ジャッジ日時 2024-09-13 02:51:33
合計ジャッジ時間 9,619 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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() * 1000L;
        double y = sc.nextInt() * 1000L;
        double h = sc.nextInt();
        int count = 0;
        while (true) {
            if (x < y && x > h) {
                count++;
                x /= 2;
                h *= 2;
            } else if (y > h) {
                count++;
                y /= 2;
                h *= 2;
            } else if (x > h) {
                count++;
                x /= 2;
                h *= 2;
            } else {
                break;
            }
        }
        System.out.println(count);
    }
}
0