結果

問題 No.126 2基のエレベータ
ユーザー naipia
提出日時 2018-06-03 20:39:33
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 291 bytes
コンパイル時間 1,200 ms
コンパイル使用メモリ 157,784 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-30 09:27:17
合計ジャッジ時間 2,071 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    int a,b,s;
    cin >> a >> b >> s;
    if(s==1){
        cout << abs(a-s)+s << endl;
    }else{
        if(abs(a-s)>abs(b-s)) cout << abs(b-s)+abs(a-s)+a+1 << endl;
        else cout << abs(a-s)+s << endl;
    }

    return 0;
}
0