結果
問題 | No.126 2基のエレベータ |
ユーザー |
![]() |
提出日時 | 2016-02-16 20:00:08 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 424 bytes |
コンパイル時間 | 404 ms |
コンパイル使用メモリ | 57,536 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-22 07:18:16 |
合計ジャッジ時間 | 1,268 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 WA * 1 |
ソースコード
#include <iostream>#include <vector>using namespace std;#define REP(i,s,e) for (int i = s; i < e; i++)#define rep(i,n) REP(i,0,n)int main() {int a, b, s, ans;cin >> a >> b >> s;int da = abs(s - a);int db = abs(s - b);if (da <= db)ans = da + s;else if (a == 0)ans = db + (s-1) + 2;elseans = db + min(da,s-1) + a;cout << ans << endl;return 0;}