結果

問題 No.398 ハーフパイプ(2)
ユーザー chocoruskchocorusk
提出日時 2020-09-26 04:53:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 419 ms / 2,000 ms
コード長 793 bytes
コンパイル時間 121 ms
コンパイル使用メモリ 10,808 KB
実行使用メモリ 9,756 KB
最終ジャッジ日時 2023-09-10 23:30:01
合計ジャッジ時間 8,774 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 408 ms
9,728 KB
testcase_01 AC 406 ms
9,608 KB
testcase_02 AC 410 ms
9,496 KB
testcase_03 AC 413 ms
9,536 KB
testcase_04 AC 408 ms
9,560 KB
testcase_05 AC 411 ms
9,604 KB
testcase_06 AC 408 ms
9,596 KB
testcase_07 AC 407 ms
9,756 KB
testcase_08 AC 409 ms
9,560 KB
testcase_09 AC 419 ms
9,572 KB
testcase_10 AC 408 ms
9,608 KB
testcase_11 AC 410 ms
9,604 KB
testcase_12 AC 406 ms
9,644 KB
testcase_13 AC 409 ms
9,492 KB
testcase_14 AC 413 ms
9,596 KB
testcase_15 AC 410 ms
9,676 KB
testcase_16 AC 409 ms
9,724 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read=sys.stdin.buffer.read
readline=sys.stdin.buffer.readline
readlines=sys.stdin.buffer.readlines

def calc(mx):
    dp=[1]
    for i in range(6):
        newdp=[0]*(mx*(i+1)+1)
        for j in range(mx+1):
            for k in range(mx*i+1):
                newdp[k+j]+=dp[k]
        dp=newdp
    return dp
x=int(readline().decode().replace(".", ""))*4//100
dps=[calc(i) for i in range(101)]
def solve1(a, b, s):
    s-=6*a
    if s<0 or b-a<0 or b-a>100 or s>=len(dps[b-a]):
        return 0
    return dps[b-a][s]
def solve(a, b):
    return solve1(a, b, x+a+b)-solve1(a+1, b, x+a+b)-solve1(a, b-1, x+a+b)+solve1(a+1, b-1, x+a+b)
ans=0
from itertools import combinations_with_replacement
for a, b in combinations_with_replacement(range(101), 2):
    ans+=solve(a, b)
print(ans)
0