結果

問題 No.126 2基のエレベータ
ユーザー しらゆきしらゆき
提出日時 2015-11-23 12:56:16
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 725 bytes
コンパイル時間 2,443 ms
コンパイル使用メモリ 99,496 KB
実行使用メモリ 22,952 KB
最終ジャッジ日時 2023-10-11 18:18:29
合計ジャッジ時間 6,259 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
20,808 KB
testcase_01 AC 57 ms
20,884 KB
testcase_02 WA -
testcase_03 AC 58 ms
20,796 KB
testcase_04 AC 59 ms
20,812 KB
testcase_05 AC 58 ms
22,792 KB
testcase_06 AC 58 ms
20,776 KB
testcase_07 AC 59 ms
20,884 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 59 ms
22,796 KB
testcase_11 AC 58 ms
22,744 KB
testcase_12 AC 58 ms
22,744 KB
testcase_13 AC 58 ms
20,916 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 58 ms
20,752 KB
testcase_17 AC 59 ms
20,716 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 58 ms
22,796 KB
testcase_22 AC 57 ms
20,788 KB
testcase_23 AC 58 ms
20,840 KB
testcase_24 AC 59 ms
22,844 KB
testcase_25 AC 59 ms
20,808 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 58 ms
20,768 KB
testcase_29 AC 57 ms
20,800 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

class Program
{
    static void Main()
    {
        var tmp = Console.ReadLine().Split();
        int a = int.Parse(tmp[0]);
        int b = int.Parse(tmp[1]);
        int s = int.Parse(tmp[2]);

        int ans = 0;

        if (Math.Abs(a - s) <= Math.Abs(b - s))
        {
            if (a < s) ans += s - a;
            ans += s;
        }
        else
        {
            if (a > b)
            {
                if (s > b) ans += 2 * a - b;
                else ans += 2 * a - s;
            }
            else
            {
                if (a == 0) ans++;
                if (s > b) ans += 2 * s - b;
                else ans += b;
            }
        }

        Console.WriteLine(ans);
    }
}
0