結果
| 問題 | 
                            No.269 見栄っ張りの募金活動
                             | 
                    
| コンテスト | |
| ユーザー | 
                             ntuda
                         | 
                    
| 提出日時 | 2024-10-23 23:38:14 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 400 bytes | 
| コンパイル時間 | 567 ms | 
| コンパイル使用メモリ | 82,504 KB | 
| 実行使用メモリ | 110,612 KB | 
| 最終ジャッジ日時 | 2024-10-23 23:38:22 | 
| 合計ジャッジ時間 | 8,673 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 WA * 2 | 
| other | AC * 1 TLE * 1 -- * 20 | 
ソースコード
from functools import lru_cache
@lru_cache(maxsize=2000000)
def f(x, y):
    if x == 0:
        return 1
    if y == 1:
        return 1
    ret = 0
    for i in range(x // y + 1):
        ret += f(x - i * y, y - 1)
        ret %= MOD
    print(x,y,ret)
    return ret
MOD = 10 ** 9 + 7
N, S, K = map(int, input().split())
S -= K * (N - 1) * N // 2
if S < 0:
    print(0)
    exit()
print(f(S, N))
            
            
            
        
            
ntuda