結果
| 問題 |
No.126 2基のエレベータ
|
| コンテスト | |
| ユーザー |
koyumeishi
|
| 提出日時 | 2015-01-13 23:31:42 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 554 bytes |
| コンパイル時間 | 578 ms |
| コンパイル使用メモリ | 72,220 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-22 05:24:31 |
| 合計ジャッジ時間 | 1,354 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 WA * 6 |
ソースコード
#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{
if(a>0){
ans += abs(s-b);
ans += abs(a-s);
s = a;
ans += s;
}else{
ans += abs(s-b);
ans += abs(1-s);
s = 1;
ans += abs(a-1)+1;
}
}
}else{
ans = abs(a-s)+1;
}
cout << ans << endl;
return 0;
}
koyumeishi