結果

問題 No.1106 🦉 何事もバランスが大事
ユーザー shotoyooshotoyoo
提出日時 2021-06-17 23:47:50
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 307 ms / 2,000 ms
コード長 574 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 87,212 KB
実行使用メモリ 89,776 KB
最終ジャッジ日時 2023-09-02 10:48:16
合計ジャッジ時間 21,507 ms
ジャッジサーバーID
(参考情報)
judge16 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 106 ms
72,344 KB
testcase_01 AC 106 ms
72,612 KB
testcase_02 AC 108 ms
72,472 KB
testcase_03 AC 112 ms
76,324 KB
testcase_04 AC 230 ms
81,880 KB
testcase_05 AC 109 ms
72,636 KB
testcase_06 AC 108 ms
72,604 KB
testcase_07 AC 107 ms
72,548 KB
testcase_08 AC 107 ms
72,468 KB
testcase_09 AC 110 ms
76,212 KB
testcase_10 AC 112 ms
76,332 KB
testcase_11 AC 115 ms
76,240 KB
testcase_12 AC 148 ms
80,852 KB
testcase_13 AC 173 ms
81,272 KB
testcase_14 AC 182 ms
80,744 KB
testcase_15 AC 160 ms
80,628 KB
testcase_16 AC 156 ms
80,624 KB
testcase_17 AC 153 ms
80,312 KB
testcase_18 AC 157 ms
80,364 KB
testcase_19 AC 156 ms
80,552 KB
testcase_20 AC 185 ms
83,088 KB
testcase_21 AC 204 ms
82,976 KB
testcase_22 AC 195 ms
83,636 KB
testcase_23 AC 218 ms
84,956 KB
testcase_24 AC 208 ms
83,768 KB
testcase_25 AC 255 ms
87,924 KB
testcase_26 AC 307 ms
89,776 KB
testcase_27 AC 230 ms
84,092 KB
testcase_28 AC 225 ms
84,512 KB
testcase_29 AC 173 ms
80,916 KB
testcase_30 AC 258 ms
84,052 KB
testcase_31 AC 222 ms
82,752 KB
testcase_32 AC 218 ms
83,732 KB
testcase_33 AC 222 ms
83,764 KB
testcase_34 AC 222 ms
83,676 KB
testcase_35 AC 214 ms
83,664 KB
testcase_36 AC 258 ms
86,364 KB
testcase_37 AC 167 ms
80,420 KB
testcase_38 AC 222 ms
83,840 KB
testcase_39 AC 238 ms
87,436 KB
testcase_40 AC 248 ms
87,604 KB
testcase_41 AC 264 ms
87,952 KB
testcase_42 AC 266 ms
88,012 KB
testcase_43 AC 265 ms
87,956 KB
testcase_44 AC 261 ms
88,264 KB
testcase_45 AC 261 ms
87,932 KB
testcase_46 AC 238 ms
85,180 KB
testcase_47 AC 252 ms
86,588 KB
testcase_48 AC 240 ms
82,868 KB
testcase_49 AC 237 ms
84,188 KB
testcase_50 AC 208 ms
82,320 KB
testcase_51 AC 194 ms
82,780 KB
testcase_52 AC 252 ms
85,376 KB
testcase_53 AC 251 ms
85,248 KB
testcase_54 AC 215 ms
81,744 KB
testcase_55 AC 215 ms
82,936 KB
testcase_56 AC 282 ms
85,520 KB
testcase_57 AC 283 ms
85,600 KB
testcase_58 AC 284 ms
85,636 KB
testcase_59 AC 226 ms
83,336 KB
testcase_60 AC 238 ms
88,440 KB
testcase_61 AC 261 ms
86,892 KB
testcase_62 AC 236 ms
84,440 KB
testcase_63 AC 223 ms
82,652 KB
testcase_64 AC 240 ms
86,320 KB
testcase_65 AC 200 ms
84,404 KB
testcase_66 AC 213 ms
83,792 KB
testcase_67 AC 278 ms
88,812 KB
testcase_68 AC 227 ms
83,852 KB
testcase_69 AC 261 ms
82,988 KB
testcase_70 AC 259 ms
82,820 KB
testcase_71 AC 257 ms
83,004 KB
testcase_72 AC 244 ms
85,628 KB
testcase_73 AC 221 ms
82,908 KB
testcase_74 AC 242 ms
84,588 KB
testcase_75 AC 256 ms
89,656 KB
testcase_76 AC 227 ms
80,808 KB
testcase_77 AC 224 ms
81,128 KB
testcase_78 AC 239 ms
82,340 KB
testcase_79 AC 236 ms
82,392 KB
testcase_80 AC 234 ms
81,800 KB
testcase_81 AC 232 ms
81,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda : sys.stdin.readline().rstrip()

sys.setrecursionlimit(2*10**5+10)
write = lambda x: sys.stdout.write(x+"\n")
debug = lambda x: sys.stderr.write(x+"\n")
writef = lambda x: print("{:.12f}".format(x))


n = int(input())
from functools import lru_cache
@lru_cache(1<<20)
def sub(n,v,ok):
    if n<0:
        ans = 0
    elif n==0 and v==0 and ok:
        ans = 1
    elif n==0:
        ans = 0
    else:
        ans = sum((sub((n+i)//5, v+i, i<0 or (i==0 and ok)) for i in range(-2, 3)))
#     print(n,v,ans)
    return ans
ans = sub(n,0,0)
print(ans)
0