結果

問題 No.281 門松と魔法(1)
ユーザー ynyn
提出日時 2015-09-18 23:35:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,309 bytes
コンパイル時間 73 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-04-24 11:41:32
合計ジャッジ時間 2,762 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,880 KB
testcase_01 AC 27 ms
10,752 KB
testcase_02 WA -
testcase_03 AC 27 ms
10,752 KB
testcase_04 AC 27 ms
10,752 KB
testcase_05 AC 26 ms
10,880 KB
testcase_06 AC 26 ms
10,880 KB
testcase_07 AC 26 ms
10,752 KB
testcase_08 AC 26 ms
10,752 KB
testcase_09 AC 26 ms
10,752 KB
testcase_10 AC 25 ms
10,752 KB
testcase_11 AC 26 ms
10,752 KB
testcase_12 AC 26 ms
10,752 KB
testcase_13 AC 26 ms
10,752 KB
testcase_14 AC 26 ms
10,752 KB
testcase_15 AC 27 ms
10,880 KB
testcase_16 AC 27 ms
10,880 KB
testcase_17 AC 30 ms
10,752 KB
testcase_18 AC 27 ms
10,880 KB
testcase_19 AC 26 ms
10,752 KB
testcase_20 AC 26 ms
10,752 KB
testcase_21 AC 27 ms
10,752 KB
testcase_22 AC 26 ms
10,880 KB
testcase_23 AC 26 ms
10,752 KB
testcase_24 AC 27 ms
10,880 KB
testcase_25 WA -
testcase_26 AC 24 ms
10,752 KB
testcase_27 AC 25 ms
10,752 KB
testcase_28 AC 26 ms
10,880 KB
testcase_29 AC 27 ms
10,752 KB
testcase_30 AC 26 ms
10,752 KB
testcase_31 RE -
testcase_32 AC 26 ms
10,752 KB
testcase_33 AC 26 ms
10,880 KB
testcase_34 AC 26 ms
10,880 KB
testcase_35 AC 26 ms
10,752 KB
testcase_36 AC 26 ms
10,880 KB
testcase_37 AC 26 ms
10,880 KB
testcase_38 WA -
testcase_39 AC 27 ms
10,880 KB
testcase_40 AC 28 ms
10,752 KB
testcase_41 WA -
testcase_42 AC 28 ms
10,752 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 AC 27 ms
10,752 KB
testcase_46 RE -
testcase_47 AC 26 ms
10,752 KB
testcase_48 RE -
testcase_49 RE -
testcase_50 RE -
testcase_51 WA -
testcase_52 RE -
testcase_53 RE -
testcase_54 AC 29 ms
10,752 KB
testcase_55 AC 27 ms
10,752 KB
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] :
    if h[0] != h[2]:
        ans = 0
    elif (h[0] - h[1]) > d:
        ans = 0
    elif h[0] - h[1] == d:
        if 2 * d == h[0]:
            ans = -1
        else:
            ans = 5
    else:
        if h[0] == d:
            ans = -1
        else:
            ans = 3
    print(ans)
    exit()

elif h[0] < h[1] and h[2] < h[1]:
    if h[0] != h[2]:
        ans = 0
    elif h[0] == 0 and h[2] == 0:
        ans = -1
    else:
        ans = 0
    print(ans)
    exit()

if h[2] >= h[0]:
    tmp = h[0]
    h[0] = h[2]
    h[2] = tmp

if min(h) == max(h):
    if min(h) <= d:
        ans = -1
    else:
        ans = 3
    print(ans)
    exit()

if h[2] == 0:
    ans = (h[0]-h[1]) // d + 1
    if h[0] == ans * d:
        ans = -1
    print(ans)
    exit()

if (h[0] - h[1]) == (h[1] - h[2]):
    ans = (h[0]-h[1]) // d + 1
    #if (h[0]-h[1]) % d == 0:
    #    ans -= 1
    if h[0] == 2 * d:
        ans = -1
    print(ans)
    exit()

if (h[0] - h[1]) > (h[1] - h[2]):
    ans = (h[1]-h[2]) // d + 1
    #if (h[1]-h[2]) % d == 0:
    #    ans -= 1
    print(ans)
    exit()
else:
    ans = (h[0]-h[1]) // d + 1
    if h[0] == 2 * d:
        ans = -1
    print(ans)
    exit()
0