結果

問題 No.1106 🦉 何事もバランスが大事
ユーザー mkawa2mkawa2
提出日時 2020-07-10 11:33:00
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 1,495 bytes
コンパイル時間 422 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 11,264 KB
最終ジャッジ日時 2024-04-18 10:54:11
合計ジャッジ時間 4,975 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
11,008 KB
testcase_01 AC 31 ms
10,880 KB
testcase_02 AC 33 ms
10,880 KB
testcase_03 AC 31 ms
11,008 KB
testcase_04 AC 33 ms
11,136 KB
testcase_05 AC 31 ms
11,008 KB
testcase_06 AC 30 ms
10,880 KB
testcase_07 AC 31 ms
10,880 KB
testcase_08 AC 30 ms
10,880 KB
testcase_09 AC 32 ms
11,008 KB
testcase_10 AC 31 ms
11,008 KB
testcase_11 AC 31 ms
11,008 KB
testcase_12 AC 30 ms
11,008 KB
testcase_13 AC 31 ms
11,008 KB
testcase_14 AC 30 ms
11,008 KB
testcase_15 AC 31 ms
11,008 KB
testcase_16 AC 31 ms
10,880 KB
testcase_17 AC 30 ms
11,008 KB
testcase_18 AC 30 ms
11,008 KB
testcase_19 AC 30 ms
11,008 KB
testcase_20 AC 31 ms
11,136 KB
testcase_21 AC 30 ms
11,136 KB
testcase_22 AC 32 ms
11,008 KB
testcase_23 AC 31 ms
11,008 KB
testcase_24 AC 32 ms
11,008 KB
testcase_25 AC 32 ms
11,008 KB
testcase_26 AC 32 ms
11,136 KB
testcase_27 AC 32 ms
11,008 KB
testcase_28 AC 32 ms
11,008 KB
testcase_29 AC 34 ms
11,008 KB
testcase_30 AC 33 ms
11,136 KB
testcase_31 AC 33 ms
11,008 KB
testcase_32 AC 32 ms
11,264 KB
testcase_33 AC 32 ms
11,008 KB
testcase_34 AC 32 ms
11,136 KB
testcase_35 AC 32 ms
11,008 KB
testcase_36 AC 33 ms
11,008 KB
testcase_37 AC 33 ms
11,136 KB
testcase_38 AC 34 ms
11,136 KB
testcase_39 AC 32 ms
11,008 KB
testcase_40 AC 33 ms
11,008 KB
testcase_41 AC 33 ms
11,008 KB
testcase_42 AC 34 ms
11,136 KB
testcase_43 AC 33 ms
11,008 KB
testcase_44 AC 33 ms
11,008 KB
testcase_45 AC 33 ms
11,264 KB
testcase_46 AC 35 ms
11,136 KB
testcase_47 AC 33 ms
11,136 KB
testcase_48 AC 32 ms
11,008 KB
testcase_49 AC 33 ms
11,008 KB
testcase_50 AC 32 ms
11,136 KB
testcase_51 AC 33 ms
11,136 KB
testcase_52 AC 34 ms
11,136 KB
testcase_53 AC 33 ms
11,264 KB
testcase_54 AC 32 ms
11,136 KB
testcase_55 AC 32 ms
11,136 KB
testcase_56 AC 32 ms
11,008 KB
testcase_57 AC 31 ms
11,136 KB
testcase_58 AC 34 ms
11,136 KB
testcase_59 AC 33 ms
11,264 KB
testcase_60 AC 33 ms
11,136 KB
testcase_61 AC 32 ms
11,136 KB
testcase_62 AC 32 ms
11,008 KB
testcase_63 AC 32 ms
11,008 KB
testcase_64 AC 32 ms
11,008 KB
testcase_65 AC 32 ms
11,136 KB
testcase_66 AC 32 ms
11,136 KB
testcase_67 AC 32 ms
11,136 KB
testcase_68 AC 32 ms
11,136 KB
testcase_69 AC 32 ms
11,008 KB
testcase_70 AC 35 ms
11,264 KB
testcase_71 AC 35 ms
11,136 KB
testcase_72 AC 32 ms
11,008 KB
testcase_73 AC 32 ms
11,136 KB
testcase_74 AC 32 ms
11,264 KB
testcase_75 AC 32 ms
11,136 KB
testcase_76 AC 32 ms
11,008 KB
testcase_77 AC 32 ms
11,008 KB
testcase_78 AC 32 ms
11,008 KB
testcase_79 AC 34 ms
11,136 KB
testcase_80 AC 33 ms
11,008 KB
testcase_81 AC 33 ms
11,136 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:
            if d+i*2<55:dp[i+1][d+i*2][0]=1
            if d == 4 and 3 + i * 2<55: 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