結果

問題 No.396 クラス替え
ユーザー tentententen
提出日時 2020-09-29 13:16:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 1,000 ms
コード長 652 bytes
コンパイル時間 2,552 ms
コンパイル使用メモリ 71,548 KB
実行使用メモリ 56,240 KB
最終ジャッジ日時 2023-09-16 20:02:00
合計ジャッジ時間 6,059 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
56,008 KB
testcase_01 AC 122 ms
55,892 KB
testcase_02 AC 123 ms
56,052 KB
testcase_03 AC 123 ms
55,744 KB
testcase_04 AC 123 ms
55,528 KB
testcase_05 AC 124 ms
55,800 KB
testcase_06 AC 125 ms
55,800 KB
testcase_07 AC 126 ms
56,048 KB
testcase_08 AC 124 ms
55,808 KB
testcase_09 AC 123 ms
56,240 KB
testcase_10 AC 125 ms
55,796 KB
testcase_11 AC 127 ms
55,532 KB
testcase_12 AC 123 ms
56,176 KB
testcase_13 AC 125 ms
55,528 KB
testcase_14 AC 124 ms
55,792 KB
testcase_15 AC 121 ms
55,844 KB
testcase_16 AC 122 ms
56,052 KB
testcase_17 AC 121 ms
55,852 KB
testcase_18 AC 123 ms
55,536 KB
testcase_19 AC 127 ms
55,788 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int x = sc.nextInt() - 1;
        int y = sc.nextInt() - 1;
        int xs;
        if (x / m % 2 == 0) {
            xs = x % m;
        } else {
            xs = m - x % m - 1;
        }
        int ys;
        if (y / m % 2 == 0) {
            ys = y % m;
        } else {
            ys = m - y % m - 1;
        }
        if (xs == ys) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}
0