結果

問題 No.126 2基のエレベータ
ユーザー lunnearlunnear
提出日時 2019-02-04 04:07:23
言語 C++11
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 354 bytes
コンパイル時間 604 ms
コンパイル使用メモリ 53,620 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-23 13:20:00
合計ジャッジ時間 1,748 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <stdlib.h>

int main()
{
    int a, b, s;
    int move = 0;
    std::cin >> a >> b >> s;
    
    int as = abs(a - s);
    int bs = abs(b - s);
    
    if((s == 1) || (as <= bs))
    {
        move += as + s;
    }
    else
    {
        move += bs + s - 1 + a;
    }
    
    std::cout << move << std::endl;
    return 0;
}
0