結果

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

ソースコード

diff #

#include<iostream>
#include<cmath>
using namespace std;

int main() {
  int a, b, s;
  cin >> a >> b >> s;

  int ans;


  if((a > s && s > b) || (b > s && s > a)) {
    if(abs(s-a) < abs(s-b)) {
      ans = s + a;
    } else {
      ans = b + 1;
    }
  }else {
    if(a > s) ans = a;
    else ans = s;
  }

  cout << ans << endl;
  return 0;
}
0