結果
| 問題 |
No.269 見栄っ張りの募金活動
|
| コンテスト | |
| ユーザー |
畠内康輔
|
| 提出日時 | 2021-04-20 14:56:20 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 517 bytes |
| コンパイル時間 | 644 ms |
| コンパイル使用メモリ | 71,696 KB |
| 実行使用メモリ | 11,136 KB |
| 最終ジャッジ日時 | 2024-07-04 05:20:49 |
| 合計ジャッジ時間 | 1,565 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 6 WA * 16 |
ソースコード
#include <iostream>
#include <vector>
using namespace std;
int main(){
int N,S,K; cin >> N >> S >> K;
vector<vector<int> > dp(N+1,vector<int>(S+1,0)); // (1)人目までの金額が決定していて、合計金額が(2)となるような場合のかず。
dp[1][0]=1;
for(int i=1;i<=N;i++){
for(int j=0;j<=S;j++){
if( j >= K*(N-i+1) ) dp[i][j] += dp[i-1][j-K*(N-i+1)];
if( j >= K*(N-i+1) ) dp[i][j] += dp[i][j-(N-i+1)];
}
}
cout << dp[N][S] << endl;
}
畠内康輔