結果
問題 |
No.281 門松と魔法(1)
|
ユーザー |
![]() |
提出日時 | 2015-09-18 22:57:16 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 687 bytes |
コンパイル時間 | 239 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-11-06 18:52:54 |
合計ジャッジ時間 | 3,467 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 15 WA * 40 RE * 2 |
ソースコード
d = int(input()) h = [0] * 3 h[0] = int(input()) h[1] = int(input()) h[2] = int(input()) if h[0] > h[1] and h[2] > h[1]: ans = 0 elif h[0] < h[1] and h[2] < h[1]: ans = 0 elif h[1] == 0 and (h[0] == 0 or h[2] == 0): ans = -1 elif min(h) == 0: ans = (max(h) - h[1]) // d if (max(h) - h[1]) % d == 0: ans += 1 elif min(h) == max(h): ans = 1 else: if h[2] >= h[0]: tmp = h[0] h[0] = h[2] h[2] = tmp if (h[0] - h[1]) > (h[1] - h[2]): ans = (h[1]-h[2]) // d if (h[1]-h[2]) % d == 0: ans += 1 else: ans = (h[0]-h[1]) // d if (h[0]-h[1]) % d == 0: ans += 1 print(ans)