結果

問題 No.126 2基のエレベータ
ユーザー dnish
提出日時 2017-07-11 22:32:27
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 282 bytes
コンパイル時間 1,597 ms
コンパイル使用メモリ 166,064 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-07 15:08:42
合計ジャッジ時間 2,813 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define p(s) cout<<(s)<<endl
using namespace std;

int main() {
	int A,B,now;
	cin>>A>>B>>now;
	int s=abs(A-now);
	int t=abs(B-now);
	if(s<=t||now==1){
		p(s+now);
	}else if(A!=0){
		int u=(now-1<s?now-1:s);
		p(s+A+u);
	}else{
		p(now+t+1);
	}
	return 0;
}
0