結果

問題 No.281 門松と魔法(1)
ユーザー tnoda_
提出日時 2015-10-02 15:19:55
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 388 bytes
コンパイル時間 378 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-06 19:44:02
合計ジャッジ時間 2,459 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 39 WA * 13 RE * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

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