結果

問題 No.1010 折って重ねて
ユーザー ntk3264
提出日時 2020-04-03 02:29:18
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 808 bytes
コンパイル時間 2,013 ms
コンパイル使用メモリ 74,564 KB
実行使用メモリ 41,844 KB
最終ジャッジ日時 2024-06-28 17:37:42
合計ジャッジ時間 8,430 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 40 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.PrintWriter;
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

    PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {

        long x = sc.nextLong()*1000;
        long y = sc.nextLong()*1000;
        long h = sc.nextLong();

        int ans = 0;

        while (x>h || y>h) {
            if (y<x) {
                long tmp = y;
                y = x;
                x = tmp;
            }
            if (x>h) {
                x /= 2;
                h *= 2;
                ans++;
            } else if (y>h) {
                y /= 2;
                h *= 2;
                ans++;
            }
        }

        out.print(ans);
        out.flush();

    }

}
0