結果
問題 |
No.126 2基のエレベータ
|
ユーザー |
|
提出日時 | 2016-07-31 02:25:14 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 773 bytes |
コンパイル時間 | 1,520 ms |
コンパイル使用メモリ | 165,388 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-06 21:26:20 |
合計ジャッジ時間 | 2,607 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 WA * 13 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i)) #define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr) #define all(x) (x).begin(),(x).end() #define mp make_pair #define pb push_back #define fi first #define se second int main() { int a,b,s; cin >>a >>b >>s; int ans=0; if(abs(a-s)>abs(b-s)) {//現在のフロアでボタンを押すとBが来る時 //Aのあるフロアまで移動してから地下へ if(a>0) ans=abs(a-b); else ans=abs(s-b)+s-1+2; } else {//現在のフロアでボタンを押すとAが来る時 //そのまま移動 ans=abs(a-s)+s; } cout << ans << endl; return 0; }