結果
| 問題 | No.126 2基のエレベータ |
| コンテスト | |
| ユーザー |
ry0u_yd
|
| 提出日時 | 2015-09-02 16:19:04 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 659 bytes |
| 記録 | |
| コンパイル時間 | 653 ms |
| コンパイル使用メモリ | 65,948 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-18 17:51:44 |
| 合計ジャッジ時間 | 1,709 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 WA * 5 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>
#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main() {
int a,b,s;
cin >> a >> b >> s;
if(abs(a-s) <= abs(b-s)) {
cout << s + abs(a-s) << endl;
} else {
if(a == 0) {
cout << abs(b-s) + s - 1 + 2 << endl;
} else {
cout << abs(b-s) + s -1 + a << endl;
}
}
return 0;
}
ry0u_yd