結果
| 問題 | No.1581 Multiple Sequence |
| コンテスト | |
| ユーザー |
koheijkt
|
| 提出日時 | 2026-05-16 10:46:59 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 431 bytes |
| 記録 | |
| コンパイル時間 | 144 ms |
| コンパイル使用メモリ | 85,248 KB |
| 実行使用メモリ | 61,824 KB |
| 最終ジャッジ日時 | 2026-05-16 10:47:13 |
| 合計ジャッジ時間 | 4,097 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 TLE * 1 |
| other | -- * 21 |
ソースコード
import sys
sys.setrecursionlimit(10**8)
MOD = 10**9+7
from functools import lru_cache
@lru_cache(maxsize=None)
def f(cur, nokori):
res = 0
for i in range(1, M + 1):
# cur * i
nex = cur * i
if nex < nokori:
if nokori - nex >= nex:
res += f(nex, nokori - nex)
elif nex == nokori:
res += 1
return res%MOD
M = int(input())
ans = f(1, M)
print(ans)
koheijkt