結果

問題 No.126 2基のエレベータ
ユーザー lunnear
提出日時 2019-02-04 04:10:07
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 385 bytes
コンパイル時間 501 ms
コンパイル使用メモリ 54,136 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-23 13:30:55
合計ジャッジ時間 1,569 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23 WA * 4
権限があれば一括ダウンロードができます

ソースコード

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;
        move += (a == 0)? 2:0;
    }
    
    std::cout << move << std::endl;
    return 0;
}
0