結果

問題 No.269 見栄っ張りの募金活動
ユーザー kyuridenamidakyuridenamida
提出日時 2015-08-21 23:23:10
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 721 bytes
コンパイル時間 1,313 ms
コンパイル使用メモリ 145,936 KB
実行使用メモリ 12,192 KB
最終ジャッジ日時 2023-09-25 15:28:01
合計ジャッジ時間 20,236 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
12,052 KB
testcase_01 AC 5 ms
12,112 KB
testcase_02 AC 5 ms
12,048 KB
testcase_03 AC 19 ms
12,124 KB
testcase_04 AC 3,973 ms
12,184 KB
testcase_05 AC 5 ms
12,192 KB
testcase_06 AC 5 ms
12,056 KB
testcase_07 TLE -
testcase_08 AC 5 ms
12,120 KB
testcase_09 AC 5 ms
11,996 KB
testcase_10 AC 5 ms
12,064 KB
testcase_11 AC 1,835 ms
12,048 KB
testcase_12 AC 5 ms
12,040 KB
testcase_13 AC 814 ms
12,044 KB
testcase_14 AC 605 ms
11,988 KB
testcase_15 AC 1,152 ms
12,108 KB
testcase_16 AC 5 ms
11,996 KB
testcase_17 AC 5 ms
11,980 KB
testcase_18 AC 1,201 ms
12,048 KB
testcase_19 AC 387 ms
12,048 KB
testcase_20 AC 266 ms
12,044 KB
testcase_21 AC 958 ms
11,988 KB
testcase_22 AC 283 ms
12,036 KB
testcase_23 AC 11 ms
12,060 KB
testcase_24 AC 727 ms
12,124 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

string tb1 = "A123456789TJQK";
string tb2 = "DCHS";

bool cmp(string a,string b){
	a[0] = 'A'+tb2.find(a[0]);
	a[1] = 'A'+tb1.find(a[1]);
	b[0] = 'A'+tb2.find(b[0]);
	b[1] = 'A'+tb1.find(b[1]);	
	return a < b;
}

int Klim;

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(){
	memset(dp,-1,sizeof(dp));
	cin >> N >> S >> K;
	S -= K*N*(N-1)/2;
	cout << dfs(N,S) << endl;
	
}
0