結果

問題 No.281 門松と魔法(1)
コンテスト
ユーザー tnoda_
提出日時 2015-10-02 15:19:55
言語 PyPy2
(7.3.15)
結果
WA  
実行時間 -
コード長 388 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 220 ms
コンパイル使用メモリ 77,600 KB
最終ジャッジ日時 2025-12-03 17:12:50
ジャッジサーバーID
(参考情報)
judge5 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 39 WA * 13 RE * 5
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

d = input()
H = []
for i in range(3):
    H.append(input())


def upward():
    if H[1] == 0:
        return None
    d0 = H[0] - H[1]
    d2 = H[2] - H[1]
    return max(d0/d, d2/d, -1) + 1


def downward():
    if H[0] * H[2] == 0:
        return None
    return max((H[1] - min(H[0], H[2]))/d, -1) + 1

ans = min(upward(), downward())
if ans is None:
    print(-1)
else:
    print(ans)
0