結果

問題 No.126 2基のエレベータ
ユーザー Onju
提出日時 2015-02-04 01:04:44
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 280 bytes
コンパイル時間 539 ms
コンパイル使用メモリ 57,568 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-23 07:19:42
合計ジャッジ時間 1,503 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstring>
#include <cmath>

using namespace std;

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

	if (S == 1)
		cout << abs(A - 1) + 1;
	else if (abs(A - S) <= abs(B - S))
		cout << abs(A - S) + S;
	else
		cout << abs(B - S) + S + A-1;

	return 0;
}
0