結果
問題 |
No.281 門松と魔法(1)
|
ユーザー |
![]() |
提出日時 | 2015-09-25 14:12:27 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 792 bytes |
コンパイル時間 | 655 ms |
コンパイル使用メモリ | 83,372 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-06 19:41:42 |
合計ジャッジ時間 | 2,127 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 38 WA * 19 |
ソースコード
#include <algorithm> #include <vector> #include <cfloat> #include <string> #include <cmath> #include <set> #include <cstdlib> #include <map> #include <ctime> #include <iomanip> #include <functional> #include <deque> #include <iostream> #include <cstring> #include <queue> #include <cstdio> #include <stack> #include <climits> #include <sys/time.h> #include <cctype> using namespace std; typedef long long ll; int main() { ll d; cin >> d; ll a, b, c; cin >> a >> b >> c; if ((a < b && b > c) || (a > b && b < c)) { puts("0"); }else if (b == 0 || d == 0) { puts("-1"); }else { ll ans = 0; if (b <= a) { ans += (a-b)/d+1; } if (b <= c) { ans += (c-b)/d+1; } ans = min(ans, (b-min(a, c))/d+1); std::cout << ans << std::endl; } }