結果

問題 No.220 世界のなんとか2
ユーザー convexineqconvexineq
提出日時 2020-12-19 11:24:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 53 ms / 1,000 ms
コード長 275 bytes
コンパイル時間 167 ms
コンパイル使用メモリ 81,816 KB
実行使用メモリ 64,520 KB
最終ジャッジ日時 2023-10-21 09:06:53
合計ジャッジ時間 2,383 ms
ジャッジサーバーID
(参考情報)
judge10 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,452 KB
testcase_01 AC 37 ms
53,452 KB
testcase_02 AC 38 ms
53,452 KB
testcase_03 AC 40 ms
56,616 KB
testcase_04 AC 41 ms
56,616 KB
testcase_05 AC 42 ms
58,700 KB
testcase_06 AC 41 ms
58,700 KB
testcase_07 AC 42 ms
58,700 KB
testcase_08 AC 42 ms
58,700 KB
testcase_09 AC 42 ms
58,704 KB
testcase_10 AC 41 ms
58,708 KB
testcase_11 AC 42 ms
58,712 KB
testcase_12 AC 42 ms
58,716 KB
testcase_13 AC 42 ms
58,720 KB
testcase_14 AC 43 ms
58,724 KB
testcase_15 AC 44 ms
59,368 KB
testcase_16 AC 44 ms
59,368 KB
testcase_17 AC 53 ms
64,520 KB
testcase_18 AC 53 ms
64,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

d = {}
def get(x,r,f):
    if (x,r,f) in d: return d[x,r,f]
    if x < 0: return 0
    if x==0: return 1 if r == 0 or f == 1 else 0
    res = sum(get((x-i)//10, (r-i)%3, f|(i==3)) for i in range(10))
    d[x,r,f] = res
    return res

n = int(input())
print(get(10**n,0,0)-1)
0