結果

問題 No.396 クラス替え
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-16 16:27:24
言語 Java21
(openjdk 21)
結果
AC  
実行時間 126 ms / 1,000 ms
コード長 574 bytes
コンパイル時間 1,954 ms
コンパイル使用メモリ 72,088 KB
実行使用メモリ 58,044 KB
最終ジャッジ日時 2023-08-17 07:28:07
合計ジャッジ時間 5,572 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,660 KB
testcase_01 AC 126 ms
55,804 KB
testcase_02 AC 124 ms
56,588 KB
testcase_03 AC 124 ms
55,452 KB
testcase_04 AC 124 ms
58,044 KB
testcase_05 AC 123 ms
56,048 KB
testcase_06 AC 123 ms
55,812 KB
testcase_07 AC 125 ms
55,748 KB
testcase_08 AC 124 ms
55,728 KB
testcase_09 AC 123 ms
55,956 KB
testcase_10 AC 122 ms
55,980 KB
testcase_11 AC 125 ms
56,040 KB
testcase_12 AC 125 ms
55,644 KB
testcase_13 AC 126 ms
55,752 KB
testcase_14 AC 125 ms
55,748 KB
testcase_15 AC 126 ms
55,836 KB
testcase_16 AC 125 ms
55,716 KB
testcase_17 AC 123 ms
54,060 KB
testcase_18 AC 124 ms
54,220 KB
testcase_19 AC 125 ms
56,052 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