結果
| 問題 |
No.126 2基のエレベータ
|
| コンテスト | |
| ユーザー |
alpha_virginis
|
| 提出日時 | 2015-03-05 21:36:34 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 440 bytes |
| コンパイル時間 | 540 ms |
| コンパイル使用メモリ | 65,868 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-24 08:19:39 |
| 合計ジャッジ時間 | 1,789 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 WA * 13 |
ソースコード
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
int main() {
long i;
long a, b, s;
long a_s;
long b_s;
long ans;
std::cin >> a >> b >> s;
a_s = abs(a-s);
b_s = abs(b-s);
if( a == 0 ) {
ans = 2 * s;
}
else {
if(a_s > b_s) {
ans = b_s + abs(a-b) + a;
}
else {
ans = a_s + s;
}
}
std::cout << ans << std::endl;
return 0;
}
alpha_virginis