結果

問題 No.269 見栄っ張りの募金活動
ユーザー vjudge1
提出日時 2025-10-05 10:09:01
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 364 bytes
コンパイル時間 1,321 ms
コンパイル使用メモリ 161,444 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-10-05 10:09:09
合計ジャッジ時間 8,117 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 TLE * 1 -- * 1
other AC * 1 -- * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
const int Mod=1000000007;
int n,s,k;
int ans;
void dfs(int id,int lst,int m){
	if(id==n){
		if(m==s){
			ans++;
			ans%=Mod;
		}
		return;
	}
	int st=(id==0?0:lst+k);
	int ed=s-m;
	if(st>ed)return;
	for(int i=st;i<=ed;i++){
		dfs(id+1,i,m+i);
	}
}
int main(){
	cin>>n>>s>>k;
	dfs(0,0,0);
	cout<<ans<<endl;
	return 0;
}
0