結果

問題 No.396 クラス替え
ユーザー samplelpmas
提出日時 2017-05-07 18:19:58
言語 Java
(openjdk 23)
結果
AC  
実行時間 136 ms / 1,000 ms
コード長 591 bytes
コンパイル時間 2,190 ms
コンパイル使用メモリ 74,224 KB
実行使用メモリ 54,176 KB
最終ジャッジ日時 2024-09-14 14:50:34
合計ジャッジ時間 5,922 ms
ジャッジサーバーID
(参考情報)
judge6 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int students = sc.nextInt();
        int groups = sc.nextInt();
        int hanakoRank = sc.nextInt();
        int taroRank = sc.nextInt();

        if ((hanakoRank - taroRank) % (2 * groups) == 0) {
            System.out.println("YES");
            return;
        }

        if ((hanakoRank + taroRank) % (2 * groups) == 1) {
            System.out.println("YES");
            return;
        }

        System.out.println("NO");

    }

}
0