結果

問題 No.398 ハーフパイプ(2)
ユーザー matsu7874matsu7874
提出日時 2016-07-15 23:57:24
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 1,317 bytes
コンパイル時間 391 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-23 12:57:42
合計ジャッジ時間 17,157 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
10,752 KB
testcase_01 TLE -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 TLE -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

func = [1, 1, 2, 6, 24, 120, 720]


def calc(a, b, c, d):
    total = 0
    if a == b and b == c and c == d:
        return 24 * a * (100 - a) + 601
    elif a > b and b == c and c == d:
        p = [1, 3]
    elif a == b and b > c and c == d:
        p = [2, 2]
    elif a > b and b > c and c == d:
        p = [1, 1, 2]
    elif a == b and b == c and c > d:
        p = [3, 1]
    elif a > b and b == c and c > d:
        p = [2, 2]
    elif a == b and b > c and c > d:
        p = [2, 1, 1]
    elif a > b and b > c and c > d:
        p = [1, 1, 1, 1]
    else:
        print(a, b, c, d)
        exit()

    t = func[6] // func[p[-1] + 1] // func[p[0] + 1]
    for e in p[1:-1]:
        t //= func[e]
    total += t

    t = d * func[6] // func[p[0] + 1]
    for e in p[1:]:
        t //= func[e]
    total += t

    t = (100 - a) * func[6] // func[p[-1] + 1]
    for e in p[:-1]:
        t //= func[e]
    total += t

    t = (100 - a) * d * func[6]
    for e in p:
        t //= func[e]
    total += t

    return total


x = float(input())
y = int(x * 4)
total = 0
for a in range(int(x), y + 1):
    for b in range(0, min(int(2 * x), a) + 1):
        for c in range(0, min(int(4 / 3 * x), b) + 1):
            d = y - a - b - c
            if 0 <= d <= c:
                total += calc(a, b, c, d)
print(total)
0