結果
問題 | No.126 2基のエレベータ |
ユーザー |
|
提出日時 | 2018-06-15 16:50:29 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 356 bytes |
コンパイル時間 | 497 ms |
コンパイル使用メモリ | 63,724 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-30 14:50:16 |
合計ジャッジ時間 | 1,455 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 WA * 12 |
ソースコード
#include <iostream>using namespace std;int main(int argc, char* argv[]){int A,B,S;cin>>A>>B>>S;int xA=A-S;if (xA<0){xA=-xA;}int xB=B-S;if (xB<0){xB=-xB;}int maxX=min(xA,xB);int ans=0;if (maxX==xA){ans=xA+S;}else{//max=xB;if (A<B){ans=2*xB+(B-A)+1;}else{ans=xB+S+A;}}cout<<ans<<endl;return 0;}