結果
| 問題 |
No.281 門松と魔法(1)
|
| コンテスト | |
| ユーザー |
kurenai3110
|
| 提出日時 | 2016-06-14 18:10:58 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 494 bytes |
| コンパイル時間 | 662 ms |
| コンパイル使用メモリ | 63,792 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-06 19:53:09 |
| 合計ジャッジ時間 | 2,121 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 WA * 38 RE * 1 |
ソースコード
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
int main()
{
long int d, h1, h2, h3;
long int cnt;
cin >> d >> h1 >> h2 >> h3;
if (h2 >= h1&&h2 <= h3 || h2<=h1&&h2>=h1){
if (h2 < d){
cout << -1 << endl;
return 0;
}
if (h3 - h2 >= h2 - h1){
cnt = floor((h2 - h1) / d) +1;
}
else if (h3 - h2 < h2 - h1){
cnt = floor((h3 - h2) / d) +1;
}
}
else{
cnt = 0;
}
cout << cnt << endl;
return 0;
}
kurenai3110