結果
問題 |
No.396 クラス替え
|
ユーザー |
|
提出日時 | 2016-07-15 22:41:59 |
言語 | Java (openjdk 23) |
結果 |
RE
|
実行時間 | - |
コード長 | 793 bytes |
コンパイル時間 | 2,990 ms |
コンパイル使用メモリ | 78,748 KB |
実行使用メモリ | 244,488 KB |
最終ジャッジ日時 | 2024-10-15 04:33:20 |
合計ジャッジ時間 | 6,469 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 RE * 13 MLE * 1 |
ソースコード
import java.util.Scanner; public class Yukicoder396 { 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(); int[] g = new int[N]; int m = 0; boolean up = true; for (int i = 0; i < N; i++) { g[i] = m; if (up) { m++; if (m >= M) { m--; up = false; } } else { m--; if (m < 0) { m++; up = true; } } } System.out.println(g[X - 1] == g[Y - 1] ? "YES" : "NO"); } }