結果

問題 No.396 クラス替え
ユーザー GrenacheGrenache
提出日時 2016-07-15 22:38:38
言語 Java21
(openjdk 21)
結果
AC  
実行時間 53 ms / 1,000 ms
コード長 1,714 bytes
コンパイル時間 3,416 ms
コンパイル使用メモリ 75,168 KB
実行使用メモリ 51,196 KB
最終ジャッジ日時 2023-08-10 23:52:13
合計ジャッジ時間 5,327 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
50,128 KB
testcase_01 AC 51 ms
48,828 KB
testcase_02 AC 51 ms
50,268 KB
testcase_03 AC 52 ms
50,200 KB
testcase_04 AC 52 ms
50,276 KB
testcase_05 AC 51 ms
50,560 KB
testcase_06 AC 52 ms
50,012 KB
testcase_07 AC 52 ms
50,048 KB
testcase_08 AC 52 ms
50,076 KB
testcase_09 AC 52 ms
50,120 KB
testcase_10 AC 52 ms
50,212 KB
testcase_11 AC 52 ms
50,228 KB
testcase_12 AC 51 ms
50,200 KB
testcase_13 AC 52 ms
49,968 KB
testcase_14 AC 51 ms
50,428 KB
testcase_15 AC 51 ms
50,204 KB
testcase_16 AC 51 ms
49,968 KB
testcase_17 AC 51 ms
48,112 KB
testcase_18 AC 51 ms
50,072 KB
testcase_19 AC 53 ms
51,196 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;


public class Main_yukicoder396 {

    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	Printer pr = new Printer(System.out);

    	int n = sc.nextInt();
    	int m = sc.nextInt();
    	int x = sc.nextInt() - 1;
    	int y = sc.nextInt() - 1;

    	if (f(n, m, x) == f(n, m, y)) {
    		pr.println("YES");
    	} else {
    		pr.println("NO");
    	}

		sc.close();
        pr.close();
    }

	private static int f(int n, int m, int x) {
		x %= 2 * m;

		if (x < m) {
			return x + 1;
		} else {
			return 2 * m - x;
		}
	}

	@SuppressWarnings("unused")
	private static class Scanner {
		BufferedReader br;
		Iterator<String> it;

		Scanner (InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
		}

		String next() throws RuntimeException  {
			try {
				if (it == null || !it.hasNext()) {
//					it = Arrays.asList(br.readLine().split(" ")).iterator();
					it = Arrays.asList(br.readLine().split("\\p{javaWhitespace}+")).iterator();
				}
				return it.next();
			} catch (IOException e) {
				throw new IllegalStateException();
			}
		}

		int nextInt() throws RuntimeException {
			return Integer.parseInt(next());
		}

		long nextLong() throws RuntimeException {
			return Long.parseLong(next());
		}

		float nextFloat() throws RuntimeException {
			return Float.parseFloat(next());
		}

		double nextDouble() throws RuntimeException {
			return Double.parseDouble(next());
		}

		void close() {
			try {
				br.close();
			} catch (IOException e) {
//				throw new IllegalStateException();
			}
		}
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}
0