結果

問題 No.51 やる気の問題
ユーザー dazydazy
提出日時 2016-09-08 23:29:34
言語 Java21
(openjdk 21)
結果
AC  
実行時間 138 ms / 5,000 ms
コード長 665 bytes
コンパイル時間 2,774 ms
コンパイル使用メモリ 74,696 KB
実行使用メモリ 54,488 KB
最終ジャッジ日時 2024-04-27 18:05:33
合計ジャッジ時間 6,375 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
53,656 KB
testcase_01 AC 127 ms
53,888 KB
testcase_02 AC 107 ms
52,816 KB
testcase_03 AC 109 ms
53,832 KB
testcase_04 AC 112 ms
53,796 KB
testcase_05 AC 114 ms
53,768 KB
testcase_06 AC 121 ms
53,932 KB
testcase_07 AC 110 ms
53,280 KB
testcase_08 AC 124 ms
53,644 KB
testcase_09 AC 124 ms
54,204 KB
testcase_10 AC 114 ms
53,820 KB
testcase_11 AC 112 ms
54,488 KB
testcase_12 AC 105 ms
52,508 KB
testcase_13 AC 107 ms
52,856 KB
testcase_14 AC 109 ms
52,844 KB
testcase_15 AC 117 ms
54,012 KB
testcase_16 AC 117 ms
53,760 KB
testcase_17 AC 112 ms
54,104 KB
testcase_18 AC 115 ms
54,016 KB
testcase_19 AC 104 ms
52,508 KB
testcase_20 AC 104 ms
52,632 KB
testcase_21 AC 123 ms
54,080 KB
testcase_22 AC 138 ms
54,004 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Run {
    public static void main (String arg[]) {
        Scanner scan = new Scanner(System.in);
        double W = scan.nextInt();
        double D = scan.nextInt();
        if (!match(W, D)) System.exit(1);

        while (D > 1) {
            W -= Math.floor(W/(D * D));
            if (W <= 0) {
                System.out.println("0");
                System.exit(0);
            }
            D--;
        }
        System.out.println(((int) W));
    }

    public static boolean match (double... args) {
        for (double i : args) {
            if (i < 1||i > 100000) return false;
        }
        return true;
    }
}
0