結果

問題 No.396 クラス替え
ユーザー atkrym
提出日時 2016-11-07 20:25:25
言語 Java
(openjdk 23)
結果
TLE  
実行時間 -
コード長 959 bytes
コンパイル時間 2,102 ms
コンパイル使用メモリ 74,632 KB
実行使用メモリ 54,412 KB
最終ジャッジ日時 2024-11-25 04:21:42
合計ジャッジ時間 17,572 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11 TLE * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        int n = sc.nextInt();
        int m = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        int h = 0;
        int t = 0;
        int c = 0;
        while (true) {
            for (int i = 1;i <= m;i++) {
                c++;
                if (c==x) {
                    h = i;
                } else if (c==y) {
                    t = i;
                }
            }
            for (int i = m;i > 0;i--) {
                c++;
                if (c==x) {
                    h = i;
                } else if (c==y) {
                    t = i;
                }
            }
            if (c>n) break;
        }
        
        if (h==t) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}
0