結果
| 問題 | 
                            No.269 見栄っ張りの募金活動
                             | 
                    
| コンテスト | |
| ユーザー | 
                            👑  | 
                    
| 提出日時 | 2020-03-16 18:00:11 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 1,531 ms / 5,000 ms | 
| コード長 | 456 bytes | 
| コンパイル時間 | 582 ms | 
| コンパイル使用メモリ | 65,720 KB | 
| 実行使用メモリ | 11,264 KB | 
| 最終ジャッジ日時 | 2024-11-28 02:57:14 | 
| 合計ジャッジ時間 | 5,993 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 22 | 
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main(){
      | ^~~~
            
            ソースコード
#include <iostream>
#include <ctime>
using namespace std;
const int mod = 1000000007;
int dp[101][20001];
main(){
	int n,s,k;cin>>n>>s>>k;
	s -= ((n+(n-1))/2)*((n+(n-1))/2+1)/2*k;
	dp[0][0] = 1;
	if(0>s){
		cout << 0 << endl;
		return 0;
	}
	for(int i = 0; n > i; i++){
		for(int j = 0; s >= j; j++){
			if(dp[i][j] != 0){
				for(int l = 0; s >= j+l*(n-i); l++)dp[i+1][j+l*(n-i)]=(dp[i+1][j+l*(n-i)]+dp[i][j])%mod;
			}
		}
	}
	cout << dp[n][s] << endl;
}