結果

問題 No.126 2基のエレベータ
ユーザー karinohito
提出日時 2024-09-16 20:52:46
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 419 bytes
コンパイル時間 2,004 ms
コンパイル使用メモリ 192,012 KB
最終ジャッジ日時 2025-02-24 08:57:25
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
using ll = long long;



int main() {

    cin.tie(nullptr);
    ios::sync_with_stdio(false);


    int A,B,S;
    cin>>A>>B>>S;
    if(abs(S-A)<=abs(S-B)){
        cout<<abs(S-A)+abs(S)<<endl;
        return 0;
    }
    else{
        int a=abs(S-B);
        cout<<min(a+abs(S-1)+abs(A-1)+1,a+abs(S-A)+abs(S))<<endl;
    }
    
    
}
0