結果

問題 No.126 2基のエレベータ
ユーザー itezpace
提出日時 2016-09-20 09:12:02
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 432 bytes
コンパイル時間 636 ms
コンパイル使用メモリ 56,540 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-17 10:06:14
合計ジャッジ時間 1,535 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int A,B,S;
  cin>>A>>B>>S;
  int da=abs(S-A);
  int db=abs(S-B);
  int az=0;
  if(A==0) az=1;
  int ap=0;
  if(A<S) ap=1;
  int ans=0;
  if(da<=db){
    ans=da+S;
  } else if(da>db && ap==0){
    ans=db+da+da+S;
  } else if(da>db && ap==1 && az==0){
    ans=db+S;
  } else if(da>db && ap==1 && az==1){
    ans=db+S-1+2;
  }
  cout<<ans<<endl;
  return 0;
}
0