結果
| 問題 |
No.126 2基のエレベータ
|
| コンテスト | |
| ユーザー |
a
|
| 提出日時 | 2015-01-13 23:49:42 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 368 bytes |
| コンパイル時間 | 438 ms |
| コンパイル使用メモリ | 59,992 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-22 05:38:13 |
| 合計ジャッジ時間 | 1,333 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 WA * 6 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int a, b, s;
int main() {
cin >> a >> b >> s;
int move;
if (s == 1) {
move = abs(a - s) + 1;
} else if (abs(a - s) <= abs(b - s)) {
move = abs(a - s) + s;
} else {
move = abs(b - s) + abs(s - a) + a;
if (a == 0) {
move++;
}
}
cout << move << endl;
return 0;
}
a