結果
問題 |
No.126 2基のエレベータ
|
ユーザー |
|
提出日時 | 2019-08-07 00:55:24 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 289 bytes |
コンパイル時間 | 2,134 ms |
コンパイル使用メモリ | 193,024 KB |
最終ジャッジ日時 | 2025-01-07 10:55:58 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 WA * 2 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int a,b,s; cin>>a>>b>>s; int da=abs(a-s); int db=abs(b-s); if (da <= db || s==1) { cout<<da+s<<endl; } else { cout<<min(db+da+a, db+s-1+a)<<endl; } return 0; }