結果

問題 No.126 2基のエレベータ
ユーザー fiord
提出日時 2015-04-26 16:30:16
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 235 bytes
コンパイル時間 462 ms
コンパイル使用メモリ 57,948 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-05 02:49:40
合計ジャッジ時間 1,287 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>
using namespace std;
int main(){
	int a,b,s;	cin>>a>>b>>s;
	if(s==1) cout<<abs(a-s)+1;
	else if(abs(a-s)<=abs(b-s))	cout<<abs(a-s)+s;
	else 	cout<<abs(b-s)+s-1+abs(a-1)+1;
	cout<<endl;
	return 0;
}
0