結果

問題 No.1877 俺自身が線グラフになることだ
ユーザー titia
提出日時 2022-03-18 21:54:05
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 370 bytes
コンパイル時間 108 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,648 KB
最終ジャッジ日時 2024-10-03 06:43:14
合計ジャッジ時間 1,071 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11 RE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

N=int(input())
mod=10**9+7

from functools import lru_cache
@lru_cache(maxsize=None)
def calc(rest,x):
    if rest==0:
        return 1
    if x>rest:
        return 0

    ANS=0

    for i in range(rest//x+1):
        ANS+=calc(rest-i*x,x+1)
        ANS%=mod

    return ANS

print(calc(N,3))
        
0