結果

問題 No.396 クラス替え
ユーザー tenten
提出日時 2020-09-29 13:16:17
言語 Java
(openjdk 23)
結果
AC  
実行時間 132 ms / 1,000 ms
コード長 652 bytes
コンパイル時間 2,048 ms
コンパイル使用メモリ 74,236 KB
実行使用メモリ 54,744 KB
最終ジャッジ日時 2024-07-03 19:22:50
合計ジャッジ時間 6,038 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

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