結果

問題 No.396 クラス替え
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-16 16:27:24
言語 Java21
(openjdk 21)
結果
AC  
実行時間 119 ms / 1,000 ms
コード長 574 bytes
コンパイル時間 2,056 ms
コンパイル使用メモリ 79,220 KB
実行使用メモリ 41,440 KB
最終ジャッジ日時 2024-05-04 14:21:02
合計ジャッジ時間 5,148 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 107 ms
41,212 KB
testcase_01 AC 110 ms
41,292 KB
testcase_02 AC 108 ms
41,084 KB
testcase_03 AC 109 ms
41,288 KB
testcase_04 AC 111 ms
41,160 KB
testcase_05 AC 100 ms
40,232 KB
testcase_06 AC 109 ms
41,212 KB
testcase_07 AC 99 ms
39,984 KB
testcase_08 AC 106 ms
41,132 KB
testcase_09 AC 110 ms
41,004 KB
testcase_10 AC 102 ms
40,352 KB
testcase_11 AC 109 ms
41,140 KB
testcase_12 AC 94 ms
39,648 KB
testcase_13 AC 119 ms
41,440 KB
testcase_14 AC 102 ms
39,968 KB
testcase_15 AC 101 ms
39,980 KB
testcase_16 AC 111 ms
41,108 KB
testcase_17 AC 101 ms
39,940 KB
testcase_18 AC 99 ms
40,252 KB
testcase_19 AC 94 ms
39,556 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();
        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