結果

問題 No.531 エヌスクミ島の平和協定
ユーザー fkwnw3_1243fkwnw3_1243
提出日時 2017-09-07 21:41:30
言語 Java21
(openjdk 21)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 854 bytes
コンパイル時間 4,121 ms
コンパイル使用メモリ 74,380 KB
実行使用メモリ 53,588 KB
最終ジャッジ日時 2023-10-19 20:26:59
合計ジャッジ時間 7,425 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
53,584 KB
testcase_01 AC 55 ms
53,588 KB
testcase_02 AC 55 ms
53,572 KB
testcase_03 AC 54 ms
52,456 KB
testcase_04 AC 54 ms
53,580 KB
testcase_05 AC 56 ms
53,572 KB
testcase_06 AC 55 ms
53,572 KB
testcase_07 AC 55 ms
52,436 KB
testcase_08 AC 56 ms
53,584 KB
testcase_09 AC 54 ms
53,580 KB
testcase_10 AC 56 ms
53,580 KB
testcase_11 AC 55 ms
53,576 KB
testcase_12 AC 55 ms
53,584 KB
testcase_13 AC 56 ms
53,572 KB
testcase_14 AC 54 ms
53,588 KB
testcase_15 AC 54 ms
53,576 KB
testcase_16 AC 56 ms
53,576 KB
testcase_17 AC 56 ms
53,540 KB
testcase_18 AC 56 ms
52,432 KB
testcase_19 AC 55 ms
52,432 KB
testcase_20 AC 54 ms
53,588 KB
testcase_21 AC 54 ms
53,576 KB
testcase_22 AC 56 ms
53,588 KB
testcase_23 AC 54 ms
51,540 KB
testcase_24 AC 55 ms
53,576 KB
testcase_25 AC 55 ms
52,432 KB
testcase_26 AC 55 ms
53,576 KB
testcase_27 AC 54 ms
52,464 KB
testcase_28 AC 54 ms
53,588 KB
testcase_29 AC 54 ms
53,588 KB
testcase_30 AC 54 ms
53,572 KB
testcase_31 AC 54 ms
53,580 KB
testcase_32 AC 56 ms
53,532 KB
testcase_33 AC 55 ms
53,584 KB
testcase_34 AC 54 ms
52,440 KB
testcase_35 AC 55 ms
52,428 KB
testcase_36 AC 55 ms
52,452 KB
testcase_37 AC 56 ms
52,424 KB
testcase_38 AC 55 ms
53,580 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import static java.lang.System.in;

public class No531 {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));

        String[] inputs = reader.readLine().split(" ");
        int n = Integer.parseInt(inputs[0]);
        int m = Integer.parseInt(inputs[1]);

        if (n <= m) {
            System.out.println(1);
        } else {
            if (n % 2 == 0 && n / 2 <= m) {

                if ((n / 2) % m == 0) {
                    System.out.println((n / 2) / m + 1);
                } else {
                    System.out.println((n / 2) / m + 2);

                }

            } else {
                System.out.println(-1);
            }

        }

    }
}
0