結果
| 問題 |
No.126 2基のエレベータ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-04-12 16:37:13 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 263 bytes |
| コンパイル時間 | 514 ms |
| コンパイル使用メモリ | 66,956 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-10 18:32:34 |
| 合計ジャッジ時間 | 1,417 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
コンパイルメッセージ
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)||s==1)
{
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;
}
}