結果

問題 No.281 門松と魔法(1)
ユーザー ynyn
提出日時 2015-09-18 22:57:16
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 687 bytes
コンパイル時間 129 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-04-24 11:10:26
合計ジャッジ時間 3,228 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 30 ms
11,008 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 31 ms
10,880 KB
testcase_15 WA -
testcase_16 AC 31 ms
11,008 KB
testcase_17 WA -
testcase_18 AC 31 ms
10,880 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 31 ms
11,008 KB
testcase_23 WA -
testcase_24 AC 30 ms
10,752 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 30 ms
10,752 KB
testcase_30 WA -
testcase_31 RE -
testcase_32 AC 31 ms
10,880 KB
testcase_33 WA -
testcase_34 AC 29 ms
10,880 KB
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 AC 29 ms
10,752 KB
testcase_45 WA -
testcase_46 AC 30 ms
10,752 KB
testcase_47 WA -
testcase_48 AC 30 ms
11,008 KB
testcase_49 AC 30 ms
10,880 KB
testcase_50 RE -
testcase_51 WA -
testcase_52 AC 31 ms
11,008 KB
testcase_53 AC 29 ms
10,880 KB
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0