結果
| 問題 |
No.126 2基のエレベータ
|
| コンテスト | |
| ユーザー |
しらゆき
|
| 提出日時 | 2015-11-23 12:56:16 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 725 bytes |
| コンパイル時間 | 851 ms |
| コンパイル使用メモリ | 107,980 KB |
| 実行使用メモリ | 26,400 KB |
| 最終ジャッジ日時 | 2024-09-13 17:13:46 |
| 合計ジャッジ時間 | 2,550 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 WA * 10 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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);
}
}
しらゆき