結果
問題 |
No.126 2基のエレベータ
|
ユーザー |
|
提出日時 | 2018-04-12 16:34:53 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 257 bytes |
コンパイル時間 | 764 ms |
コンパイル使用メモリ | 65,408 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-26 21:26:25 |
合計ジャッジ時間 | 1,445 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 WA * 1 |
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 5 | main() | ^~~~
ソースコード
#include<iostream> #include<algorithm> using namespace std; int a,b,s; main() { cin>>a>>b>>s; if(abs(a-s)<=abs(b-s)) { cout<<abs(a-s)+s<<endl; } else if(a>0) { cout<<abs(b-s)+min(abs(a-s),s-1)+a<<endl; } else { cout<<abs(b-s)+s+1<<endl; } }