結果

問題 No.268 ラッピング(Easy)
ユーザー kyuridenamidakyuridenamida
提出日時 2015-08-21 23:35:34
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 912 bytes
コンパイル時間 2,304 ms
コンパイル使用メモリ 144,380 KB
実行使用メモリ 11,808 KB
最終ジャッジ日時 2023-09-25 15:32:56
合計ジャッジ時間 16,984 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int sum[20210] = {};
int dp[110	][20110];
int N,S,K;
vector<int> v;
int dfs(int x,int s){
	if( s < 0 ) return 0;
	if( dp[x][s] != -1 ) return dp[x][s];
	if( x == 0 ){
		return s == 0;
	}
	int ans = 0;
	for(int i = 0 ; ; i++){
		int c = i * x;
		if( c > s ) break;
		ans += dfs(x-1,s-c); 
		ans %= 1000000007;
	}
	return dp[x][s] = ans;
}



int main(){
	cin >> N >> S >> K;
	N = 100;
	S = 20000;
	K = 0;
	S -= K*N*(N-1)/2;
	if( S < 0 ) cout << 0 << endl;
	else{	
		dp[N][S] = 1;
		for(register int x = N ; x >= 1 ; x--){
			for(register int s = 0 ; s <= S ; s++){
				if( dp[x][s] == 0 ) continue;
				register int c = 0;
				register int C = dp[x][s];
				for(int k = 0 ; c <= s ; k++){
					if( c > s ) break;
					dp[x-1][s-c] += C;
					if( dp[x-1][s-c] >= 1000000007 ) dp[x-1][s-c] -= 1000000007;
					c += x;
				}
			}
		}
		cout << dp[0][0] << endl;
	}
	
}
0