結果
| 問題 | 
                            No.535 自然数の収納方法
                             | 
                    
| コンテスト | |
| ユーザー | 
                             vjudge1
                         | 
                    
| 提出日時 | 2025-03-14 16:18:25 | 
| 言語 | C++23  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 39 ms / 2,000 ms | 
| コード長 | 803 bytes | 
| コンパイル時間 | 3,559 ms | 
| コンパイル使用メモリ | 273,240 KB | 
| 実行使用メモリ | 19,136 KB | 
| 最終ジャッジ日時 | 2025-03-14 16:18:30 | 
| 合計ジャッジ時間 | 5,080 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 23 | 
ソースコード
// Problem:No.535 ????????
// Contest:yukicoder
// URL:https://yukicoder.me/problems/no/535
// Memory Limit:512 MB
// Time Limit:2000 ms
// Codeforces/Luogu Account:Butterfly_qwq
// Atcoder Account:Super_agg
// CP Duel Rating:2034
// Start Coding:03-14 15:00
// 
// Powered by CP Editor (https://cpeditor.org)
#include<bits/stdc++.h>
using namespace std;
const int N=2005,mod=1e9+7;
int n,ans,s[N],dp[N][N];
int Mod(int x){return x-(x>=mod)*mod+(x<0)*mod;}
void solve()
{
	for(int i=1;i<n;i++)
	{
		s[0]=0;
		for(int j=1;j<=n;j++)s[j]=Mod(s[j-1]+dp[i-1][j]);
		for(int j=1;j<=n;j++)dp[i][j]=s[min(n,j+max(0,i-2))];
	}
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)dp[0][i]=1;solve();
	for(int i=1;i<=n;i++)ans=Mod(ans+dp[n-1][i]);
	for(int i=2;i<=n;i++)dp[0][i]=0;solve();
	cout<<Mod(ans-dp[n-1][n]);
}
            
            
            
        
            
vjudge1