結果

問題 No.126 2基のエレベータ
ユーザー kyuridenamidakyuridenamida
提出日時 2016-07-22 19:21:06
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 335 bytes
コンパイル時間 1,273 ms
コンパイル使用メモリ 158,656 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-24 02:04:38
合計ジャッジ時間 2,538 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 RE -
testcase_02 WA -
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 RE -
testcase_06 AC 2 ms
5,376 KB
testcase_07 RE -
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 2 ms
5,376 KB
testcase_17 WA -
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 WA -
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 1 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 1 ms
5,376 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 2 ms
5,376 KB
testcase_29 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

typedef complex<double> P;
int main(){
	int A,B,S;
	cin >> A >> B >> S;
	int ans = 0;
	if( abs(A-S) > abs(B-S) ){
		ans += abs(B-S);

		if( A == 0 ){
			A += 1;
			ans += 1;
			assert(0);
		}
		ans += abs(S-A) + abs(A);
			
	}else{

		ans += abs(A-S) + abs(S) ;
	}
	cout << ans << endl;
}
0