結果

問題 No.1106 🦉 何事もバランスが大事
ユーザー mkawa2mkawa2
提出日時 2020-07-10 11:31:01
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
RE  
実行時間 -
コード長 1,466 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 10,996 KB
実行使用メモリ 8,216 KB
最終ジャッジ日時 2023-07-31 10:17:33
合計ジャッジ時間 5,878 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,124 KB
testcase_01 AC 16 ms
8,016 KB
testcase_02 AC 17 ms
8,104 KB
testcase_03 AC 17 ms
8,080 KB
testcase_04 AC 19 ms
8,164 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 17 ms
7,996 KB
testcase_08 AC 17 ms
8,008 KB
testcase_09 AC 17 ms
8,164 KB
testcase_10 AC 17 ms
8,100 KB
testcase_11 AC 17 ms
8,104 KB
testcase_12 AC 17 ms
8,000 KB
testcase_13 AC 17 ms
8,204 KB
testcase_14 AC 17 ms
8,196 KB
testcase_15 AC 17 ms
8,100 KB
testcase_16 AC 17 ms
8,080 KB
testcase_17 AC 17 ms
8,056 KB
testcase_18 AC 17 ms
8,100 KB
testcase_19 AC 17 ms
8,128 KB
testcase_20 AC 18 ms
8,208 KB
testcase_21 AC 18 ms
8,164 KB
testcase_22 AC 18 ms
8,204 KB
testcase_23 AC 18 ms
8,000 KB
testcase_24 AC 18 ms
8,056 KB
testcase_25 AC 18 ms
7,976 KB
testcase_26 AC 19 ms
8,140 KB
testcase_27 AC 19 ms
8,016 KB
testcase_28 AC 19 ms
8,116 KB
testcase_29 AC 19 ms
8,076 KB
testcase_30 AC 19 ms
7,976 KB
testcase_31 AC 19 ms
7,976 KB
testcase_32 AC 19 ms
8,028 KB
testcase_33 AC 20 ms
8,104 KB
testcase_34 AC 19 ms
8,112 KB
testcase_35 AC 19 ms
8,196 KB
testcase_36 AC 20 ms
8,020 KB
testcase_37 AC 19 ms
8,112 KB
testcase_38 AC 19 ms
8,028 KB
testcase_39 AC 20 ms
8,192 KB
testcase_40 AC 19 ms
8,204 KB
testcase_41 AC 20 ms
8,128 KB
testcase_42 AC 19 ms
7,980 KB
testcase_43 AC 19 ms
8,120 KB
testcase_44 AC 19 ms
8,216 KB
testcase_45 AC 19 ms
8,164 KB
testcase_46 AC 19 ms
8,044 KB
testcase_47 AC 19 ms
8,060 KB
testcase_48 AC 19 ms
8,160 KB
testcase_49 AC 19 ms
8,140 KB
testcase_50 AC 19 ms
8,080 KB
testcase_51 AC 19 ms
8,172 KB
testcase_52 AC 19 ms
8,076 KB
testcase_53 AC 19 ms
8,172 KB
testcase_54 AC 19 ms
8,108 KB
testcase_55 AC 19 ms
8,188 KB
testcase_56 AC 19 ms
8,180 KB
testcase_57 AC 20 ms
8,112 KB
testcase_58 AC 19 ms
8,172 KB
testcase_59 AC 19 ms
8,192 KB
testcase_60 AC 19 ms
8,056 KB
testcase_61 AC 19 ms
8,028 KB
testcase_62 AC 19 ms
8,056 KB
testcase_63 AC 19 ms
8,188 KB
testcase_64 AC 19 ms
8,208 KB
testcase_65 AC 18 ms
8,092 KB
testcase_66 AC 18 ms
8,072 KB
testcase_67 AC 18 ms
7,996 KB
testcase_68 AC 19 ms
7,980 KB
testcase_69 AC 19 ms
8,192 KB
testcase_70 AC 19 ms
8,208 KB
testcase_71 AC 19 ms
8,192 KB
testcase_72 AC 19 ms
7,980 KB
testcase_73 AC 18 ms
7,980 KB
testcase_74 AC 20 ms
7,996 KB
testcase_75 AC 19 ms
8,104 KB
testcase_76 AC 19 ms
8,168 KB
testcase_77 AC 19 ms
8,080 KB
testcase_78 AC 19 ms
8,212 KB
testcase_79 AC 19 ms
7,996 KB
testcase_80 AC 20 ms
8,072 KB
testcase_81 AC 19 ms
8,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 6)

def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def SI(): return sys.stdin.readline()[:-1]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
int1 = lambda x: int(x) - 1
def MI1(): return map(int1, sys.stdin.readline().split())
def LI1(): return list(map(int1, sys.stdin.readline().split()))
p2D = lambda x: print(*x, sep="\n")
dij = [(1, 0), (0, 1), (-1, 0), (0, -1)]

def topen(a):
    a+=3725290298461914062
    res=[]
    while a:
        a,r=divmod(a,5)
        res.append(r)
    return res[::-1]

res=topen(II())
dp=[[[0]*2 for _ in range(55)] for _ in range(28)]
first=True
for i,d in enumerate(res):
    if first:
        if d > 2:
            dp[i+1][d+i*2][0]=1
            if d == 4: dp[i + 1][3 + i * 2][1] = 1
            first=False
        continue

    for a in range(3,5):
        if i*2+a>54:break
        dp[i+1][i*2+a][1]+=1

    for j in range(55):
        pre=dp[i][j][0]
        if pre:
            if j+d<55:dp[i+1][j+d][0]+=pre
            for a in range(d):
                if j+a>54:break
                dp[i+1][j+a][1]+=pre

        pre=dp[i][j][1]
        if pre:
            for a in range(5):
                if j+a>54:break
                dp[i+1][j+a][1]+=pre
    #p2D(dp)
print(sum(dp[27][54]))
0