結果
問題 |
No.268 ラッピング(Easy)
|
ユーザー |
![]() |
提出日時 | 2015-08-21 23:35:34 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 912 bytes |
コンパイル時間 | 1,067 ms |
コンパイル使用メモリ | 158,540 KB |
実行使用メモリ | 11,852 KB |
最終ジャッジ日時 | 2024-07-18 12:17:02 |
合計ジャッジ時間 | 14,777 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 10 |
ソースコード
#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; } }