結果
| 問題 |
No.126 2基のエレベータ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-07-16 21:00:27 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 791 bytes |
| コンパイル時間 | 662 ms |
| コンパイル使用メモリ | 79,264 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-08 04:29:53 |
| 合計ジャッジ時間 | 1,770 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 WA * 11 |
ソースコード
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, string> pls;
int main()
{
ll A, B, S;
cin >> A >> B >> S;
ll ans = 0;
if (S <= A ||((A == B) && A > S)) {
ans = A;
}
else if (B > S && S > A) {
ans = min(B,((S - A) * 2)+A);
}
else if (S > A && A >= B) {
ans = 2 * S - A;
}
else if (S > B && B > A) {
ans = 2 * S - B;
}
else if (S == B && S > A) {
ans = (S-A)*2 + A;
}
cout << ans << endl;
return 0;
}