結果

問題 No.1010 折って重ねて
ユーザー ntk3264ntk3264
提出日時 2020-04-03 02:38:35
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 862 bytes
コンパイル時間 2,420 ms
コンパイル使用メモリ 72,356 KB
実行使用メモリ 56,480 KB
最終ジャッジ日時 2023-09-11 03:06:39
合計ジャッジ時間 10,543 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,948 KB
testcase_01 AC 124 ms
56,308 KB
testcase_02 AC 123 ms
56,100 KB
testcase_03 AC 123 ms
56,340 KB
testcase_04 AC 124 ms
55,860 KB
testcase_05 AC 122 ms
56,208 KB
testcase_06 AC 123 ms
55,952 KB
testcase_07 AC 126 ms
56,176 KB
testcase_08 AC 127 ms
56,156 KB
testcase_09 AC 125 ms
55,468 KB
testcase_10 AC 124 ms
55,704 KB
testcase_11 AC 124 ms
55,732 KB
testcase_12 AC 125 ms
56,096 KB
testcase_13 AC 128 ms
55,728 KB
testcase_14 AC 128 ms
55,792 KB
testcase_15 AC 128 ms
56,104 KB
testcase_16 AC 126 ms
55,912 KB
testcase_17 AC 124 ms
56,188 KB
testcase_18 AC 128 ms
55,556 KB
testcase_19 AC 124 ms
55,820 KB
testcase_20 AC 125 ms
56,200 KB
testcase_21 AC 123 ms
55,884 KB
testcase_22 AC 125 ms
56,020 KB
testcase_23 AC 124 ms
56,000 KB
testcase_24 AC 128 ms
55,780 KB
testcase_25 AC 128 ms
55,488 KB
testcase_26 AC 126 ms
55,656 KB
testcase_27 AC 125 ms
55,632 KB
testcase_28 AC 125 ms
55,584 KB
testcase_29 AC 125 ms
56,132 KB
testcase_30 AC 124 ms
56,072 KB
testcase_31 AC 125 ms
56,480 KB
testcase_32 AC 129 ms
55,748 KB
testcase_33 AC 124 ms
56,068 KB
testcase_34 AC 125 ms
56,208 KB
testcase_35 AC 127 ms
56,056 KB
testcase_36 AC 127 ms
56,104 KB
testcase_37 AC 126 ms
55,940 KB
testcase_38 WA -
testcase_39 AC 126 ms
55,764 KB
testcase_40 WA -
testcase_41 AC 125 ms
55,636 KB
testcase_42 AC 125 ms
56,032 KB
testcase_43 AC 125 ms
56,236 KB
testcase_44 AC 123 ms
55,648 KB
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

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;

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

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

    }

}
0