結果

問題 No.126 2基のエレベータ
ユーザー krotonkroton
提出日時 2015-01-02 23:03:08
言語 C++11
(gcc 13.3.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 318 bytes
コンパイル時間 1,249 ms
コンパイル使用メモリ 157,912 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-21 19:10:56
合計ジャッジ時間 2,382 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
	int A, B, S;
	cin >> A >> B >> S;

	int AS = abs(A - S);
	int BS = abs(B - S);

	if(AS <= BS){
		cout << AS + S << endl;
	} else if(A == 0) {
		cout << BS + S + 1 << endl;
	} else {
		cout << min(BS + AS + A, BS + S - 1 + A - 1 + 1) << endl;
	}

	return 0;
}
0