結果
問題 | No.126 2基のエレベータ |
ユーザー |
![]() |
提出日時 | 2015-01-13 23:26:56 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 437 bytes |
コンパイル時間 | 589 ms |
コンパイル使用メモリ | 72,088 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-22 05:22:24 |
合計ジャッジ時間 | 1,542 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 WA * 12 |
ソースコード
#include <iostream> #include <vector> #include <cstdio> #include <sstream> #include <map> #include <string> #include <algorithm> #include <queue> #include <cmath> using namespace std; int main(){ int a,b,s; cin >> a >> b >> s; int ans = 0; if(s>1){ if(abs(s-a) <= abs(s-b)){ ans += abs(s-a)+s; }else{ ans += abs(s-b); ans += abs(b-a); ans += a; } }else{ ans = abs(a-s)+1; } cout << ans << endl; return 0; }