結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,816 KB
testcase_02 WA -
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 1 ms
6,944 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 1 ms
6,940 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 2 ms
6,940 KB
testcase_17 WA -
testcase_18 AC 1 ms
6,940 KB
testcase_19 AC 1 ms
6,940 KB
testcase_20 WA -
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 2 ms
6,940 KB
testcase_23 AC 2 ms
6,940 KB
testcase_24 AC 1 ms
6,940 KB
testcase_25 AC 1 ms
6,940 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 2 ms
6,940 KB
testcase_29 AC 1 ms
6,940 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;
		}
		ans += abs(S-A) + abs(A);
		
	}else{
		if( A == 0 ){
			A += 1;
			ans += 1;
		}
		ans += abs(A-S) + abs(S) ;
	}
	cout << ans << endl;
}
0