結果
問題 | No.126 2基のエレベータ |
ユーザー |
|
提出日時 | 2016-03-05 00:31:58 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 389 bytes |
コンパイル時間 | 472 ms |
コンパイル使用メモリ | 57,976 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-24 14:12:28 |
合計ジャッジ時間 | 1,527 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 WA * 6 |
ソースコード
#include <iostream>#include <math.h>using namespace std;int main() {int a, b, s;cin >> a >> b >> s;int res;if (s == 1) {res = abs(a - s) + 1;}else {int a_to_s = abs(a - s);int b_to_s = abs(b - s);if (b_to_s < a_to_s) {res = a_to_s + b_to_s + a;if (a == 0) {++res;}}else {res = a_to_s + s;}}cout << res << endl;return 0;}