結果

問題 No.1010 折って重ねて
ユーザー ntk3264ntk3264
提出日時 2020-04-03 02:59:27
言語 Java21
(openjdk 21)
結果
AC  
実行時間 144 ms / 2,000 ms
コード長 843 bytes
コンパイル時間 2,617 ms
コンパイル使用メモリ 71,636 KB
実行使用メモリ 56,720 KB
最終ジャッジ日時 2023-09-11 03:07:19
合計ジャッジ時間 10,576 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
56,228 KB
testcase_01 AC 138 ms
55,984 KB
testcase_02 AC 139 ms
56,360 KB
testcase_03 AC 139 ms
56,028 KB
testcase_04 AC 137 ms
56,084 KB
testcase_05 AC 136 ms
55,744 KB
testcase_06 AC 139 ms
56,228 KB
testcase_07 AC 139 ms
55,704 KB
testcase_08 AC 139 ms
56,076 KB
testcase_09 AC 135 ms
56,228 KB
testcase_10 AC 138 ms
55,704 KB
testcase_11 AC 140 ms
55,948 KB
testcase_12 AC 140 ms
56,112 KB
testcase_13 AC 140 ms
56,148 KB
testcase_14 AC 140 ms
54,228 KB
testcase_15 AC 139 ms
56,392 KB
testcase_16 AC 141 ms
55,712 KB
testcase_17 AC 139 ms
56,292 KB
testcase_18 AC 139 ms
56,452 KB
testcase_19 AC 137 ms
56,124 KB
testcase_20 AC 136 ms
56,400 KB
testcase_21 AC 137 ms
55,696 KB
testcase_22 AC 137 ms
55,944 KB
testcase_23 AC 140 ms
55,884 KB
testcase_24 AC 138 ms
56,116 KB
testcase_25 AC 138 ms
56,152 KB
testcase_26 AC 139 ms
55,948 KB
testcase_27 AC 136 ms
55,740 KB
testcase_28 AC 138 ms
55,860 KB
testcase_29 AC 139 ms
56,100 KB
testcase_30 AC 139 ms
56,052 KB
testcase_31 AC 138 ms
56,116 KB
testcase_32 AC 137 ms
56,312 KB
testcase_33 AC 138 ms
56,488 KB
testcase_34 AC 139 ms
56,304 KB
testcase_35 AC 138 ms
56,720 KB
testcase_36 AC 137 ms
56,152 KB
testcase_37 AC 139 ms
56,312 KB
testcase_38 AC 138 ms
56,264 KB
testcase_39 AC 142 ms
56,072 KB
testcase_40 AC 143 ms
56,536 KB
testcase_41 AC 143 ms
56,320 KB
testcase_42 AC 144 ms
56,192 KB
testcase_43 AC 143 ms
56,084 KB
testcase_44 AC 144 ms
56,288 KB
testcase_45 AC 144 ms
56,132 KB
権限があれば一括ダウンロードができます

ソースコード

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() {

        double x = sc.nextDouble()*1000;
        double y = sc.nextDouble()*1000;
        double h = sc.nextDouble();

        int ans = 0;

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

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

    }

}
0