結果

問題 No.396 クラス替え
ユーザー りあんりあん
提出日時 2016-07-14 13:55:04
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 59 ms / 1,000 ms
コード長 984 bytes
コンパイル時間 3,427 ms
コンパイル使用メモリ 104,864 KB
実行使用メモリ 24,004 KB
最終ジャッジ日時 2023-08-10 23:50:17
合計ジャッジ時間 5,630 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
21,912 KB
testcase_01 AC 59 ms
21,788 KB
testcase_02 AC 58 ms
21,916 KB
testcase_03 AC 59 ms
21,864 KB
testcase_04 AC 59 ms
21,864 KB
testcase_05 AC 59 ms
24,004 KB
testcase_06 AC 58 ms
21,948 KB
testcase_07 AC 59 ms
19,820 KB
testcase_08 AC 58 ms
23,964 KB
testcase_09 AC 58 ms
21,972 KB
testcase_10 AC 59 ms
23,928 KB
testcase_11 AC 59 ms
23,872 KB
testcase_12 AC 59 ms
24,004 KB
testcase_13 AC 58 ms
23,952 KB
testcase_14 AC 58 ms
21,856 KB
testcase_15 AC 58 ms
21,816 KB
testcase_16 AC 58 ms
21,944 KB
testcase_17 AC 59 ms
23,812 KB
testcase_18 AC 59 ms
23,952 KB
testcase_19 AC 58 ms
21,836 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;

class Program
{
    static void Main()
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        var s = Console.ReadLine();
        if (s != s.Trim())
        {
            Console.WriteLine("unexpected spase");
            return;
        }
        var a = s.Split().Select(int.Parse).ToArray();
        var t = Console.ReadLine();
        if (t != t.Trim())
        {
            Console.WriteLine("unexpected spase");
            return;
        }
        var b = t.Split().Select(int.Parse).ToArray();
        if (b[0] == b[1])
        {
            Console.WriteLine("unexpected input");
            return;
        }
        
        sw.WriteLine(cls(a[1], b[0]) == cls(a[1], b[1]) ? "YES" : "NO");
        sw.Flush();
    }
    static int cls(int m, int x)
    {
        int a = (x - 1) % (m * 2);
        return a < m ? a + 1 : m * 2 - a;
    }
}
0