結果
| 問題 | No.126 2基のエレベータ |
| コンテスト | |
| ユーザー |
hogeover30
|
| 提出日時 | 2015-01-28 19:14:29 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 282 bytes |
| コンパイル時間 | 555 ms |
| コンパイル使用メモリ | 56,540 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-10 18:22:25 |
| 合計ジャッジ時間 | 1,414 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int a, b, s;
cin>>a>>b>>s;
if (s==1) { cout<<abs(a-1)+1<<endl; return 0; }
int x=abs(a-s), y=abs(b-s);
if (x<=y) { cout<<x+s<<endl; return 0; }
cout<<y+(a?min(x, s-1)+a:s+1)<<endl;
}
hogeover30