結果
問題 | No.1407 Kindness |
ユーザー | 👑 Kazun |
提出日時 | 2021-07-05 04:10:03 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 335 bytes |
コンパイル時間 | 280 ms |
コンパイル使用メモリ | 87,200 KB |
実行使用メモリ | 80,048 KB |
最終ジャッジ日時 | 2023-09-14 04:08:11 |
合計ジャッジ時間 | 7,369 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 102 ms
72,520 KB |
testcase_01 | AC | 102 ms
72,364 KB |
testcase_02 | AC | 102 ms
72,400 KB |
testcase_03 | AC | 104 ms
72,460 KB |
testcase_04 | AC | 102 ms
72,440 KB |
testcase_05 | AC | 103 ms
72,588 KB |
testcase_06 | AC | 102 ms
72,376 KB |
testcase_07 | AC | 102 ms
72,340 KB |
testcase_08 | AC | 101 ms
72,284 KB |
testcase_09 | AC | 104 ms
72,540 KB |
testcase_10 | AC | 105 ms
72,472 KB |
testcase_11 | AC | 100 ms
72,436 KB |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | RE | - |
testcase_24 | RE | - |
testcase_25 | RE | - |
testcase_26 | RE | - |
testcase_27 | RE | - |
testcase_28 | RE | - |
testcase_29 | AC | 160 ms
80,048 KB |
testcase_30 | RE | - |
testcase_31 | RE | - |
testcase_32 | RE | - |
testcase_33 | RE | - |
testcase_34 | RE | - |
testcase_35 | RE | - |
testcase_36 | AC | 150 ms
79,904 KB |
testcase_37 | RE | - |
ソースコード
from functools import lru_cache @lru_cache(None) def f(N): if N<=9: return N*(N+1)//2 q,r=divmod(N,10) a=r*(r+1)//2 b=(10+r)*(9-r)//2 return ((1+f(q))*a+(1+f(q-1))*b)%Mod N=int(input()) Mod=10**9+7 N_str=[int(n) for n in str(N)] M=0 for n in N_str: M=10*M+n _=f(M); _=f(M-1); print(f(N))