結果

問題 No.126 2基のエレベータ
ユーザー kroton
提出日時 2015-01-02 22:55:49
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 287 bytes
コンパイル時間 1,472 ms
コンパイル使用メモリ 157,908 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-13 01:12:59
合計ジャッジ時間 2,168 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 WA * 7
権限があれば一括ダウンロードができます

ソースコード

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 + AS + A << endl;
	} else {
		cout << BS + S + 1 << endl;
	}

	return 0;
}
0