結果

問題 No.126 2基のエレベータ
ユーザー 古寺いろは
提出日時 2015-04-06 02:08:04
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 265 bytes
コンパイル時間 1,291 ms
コンパイル使用メモリ 158,108 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-04 03:13:32
合計ジャッジ時間 2,361 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int dp[3000][3000][2];

int main() {
	int A, B, S;
	cin >> A >> B >> S;
	int ans;
	if (abs(S - A) <= abs(S - B) || S == 1){
		ans = abs(S - A) + S;
	}
	else{
		ans = abs(S - B) + (S - 1) + A;
	}
	cout << ans << endl;
}
0