結果
問題 |
No.269 見栄っ張りの募金活動
|
ユーザー |
![]() |
提出日時 | 2015-08-21 23:23:10 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 721 bytes |
コンパイル時間 | 1,389 ms |
コンパイル使用メモリ | 161,264 KB |
実行使用メモリ | 12,160 KB |
最終ジャッジ日時 | 2024-07-18 12:13:16 |
合計ジャッジ時間 | 20,603 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 TLE * 1 |
ソースコード
#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; }