結果
| 問題 |
No.126 2基のエレベータ
|
| コンテスト | |
| ユーザー |
tetsuzuki1115
|
| 提出日時 | 2018-01-30 02:13:23 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 636 bytes |
| コンパイル時間 | 582 ms |
| コンパイル使用メモリ | 79,980 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-10 18:32:31 |
| 合計ジャッジ時間 | 1,414 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;
long long MOD = 1000000007;
int main() {
int A,B,S;
cin >> A >> B >> S;
int ans = 0;
if ( abs( S-A ) <= abs( S-B ) || S == 1 ) {
ans = abs( S-A ) + S;
}
else {
ans += abs( S-B );
if ( A == 0 ) { A = 1; ans++; }
ans += min( abs(S-A)+A, S-1+A );
}
cout << ans << endl;
return 0;
}
tetsuzuki1115