結果

問題 No.396 クラス替え
ユーザー NoNo
提出日時 2018-01-27 21:50:47
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 55 ms / 1,000 ms
コード長 670 bytes
コンパイル時間 4,647 ms
コンパイル使用メモリ 104,152 KB
実行使用メモリ 22,940 KB
最終ジャッジ日時 2023-08-28 10:04:02
合計ジャッジ時間 5,657 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
20,944 KB
testcase_01 AC 54 ms
20,700 KB
testcase_02 AC 53 ms
20,788 KB
testcase_03 AC 54 ms
20,880 KB
testcase_04 AC 53 ms
20,632 KB
testcase_05 AC 54 ms
18,904 KB
testcase_06 AC 53 ms
22,820 KB
testcase_07 AC 55 ms
20,756 KB
testcase_08 AC 55 ms
20,856 KB
testcase_09 AC 53 ms
20,808 KB
testcase_10 AC 55 ms
22,728 KB
testcase_11 AC 53 ms
20,764 KB
testcase_12 AC 53 ms
20,764 KB
testcase_13 AC 53 ms
18,888 KB
testcase_14 AC 53 ms
20,888 KB
testcase_15 AC 53 ms
20,880 KB
testcase_16 AC 54 ms
22,940 KB
testcase_17 AC 55 ms
22,836 KB
testcase_18 AC 54 ms
20,772 KB
testcase_19 AC 54 ms
20,764 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace y
{
    class Program
    {
        static void Main(string[] args)
        {
            var ss = Console.ReadLine().Split();
            int n = int.Parse(ss[0]);
            int m = int.Parse(ss[1]);

            ss = Console.ReadLine().Split();
            int x = int.Parse(ss[0]);
            int y = int.Parse(ss[1]);
            Console.WriteLine(U(x, m) == U(y, m) ? "YES" : "NO");
        }

        static int U(int a, int m)
        {
            int c = 0;
            if ((Math.Ceiling((double)a / m) % 2) == 1)c = a % m == 0 ? m : a % m;
            else c = a % m == 0 ? 1 : m - a % m + 1;
            return c;
        }
    }
}
0