結果

問題 No.396 クラス替え
ユーザー kohaku_kohaku
提出日時 2016-11-16 16:27:24
言語 Java
(openjdk 23)
結果
AC  
実行時間 134 ms / 1,000 ms
コード長 574 bytes
コンパイル時間 2,247 ms
コンパイル使用メモリ 74,200 KB
実行使用メモリ 41,532 KB
最終ジャッジ日時 2024-11-26 02:19:20
合計ジャッジ時間 5,449 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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();
        int Y = sc.nextInt();
        if( cl(X,M)==cl(Y,M) ){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    }

    static int cl(int a,int b){
        a = (a-1)%(2*b)+1;
        int z=(a-1)/b;
        if(z==0){
            return a;
        }else{
            return 2*b+1-a;
        }
    }
}
0