結果
| 問題 |
No.269 見栄っ張りの募金活動
|
| コンテスト | |
| ユーザー |
tottoripaper
|
| 提出日時 | 2015-11-20 22:32:45 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 371 bytes |
| コンパイル時間 | 124 ms |
| コンパイル使用メモリ | 23,936 KB |
| 実行使用メモリ | 9,208 KB |
| 最終ジャッジ日時 | 2024-09-13 17:05:43 |
| 合計ジャッジ時間 | 984 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 WA * 1 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%d %d %d", &N, &S, &K);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <cstdio>
int MOD = 1e9 + 7;
int dp[101][20001];
int main(){
int N, S, K;
scanf("%d %d %d", &N, &S, &K);
dp[0][0] = 1;
for(int i=1;i<=N;i++){
for(int j=0;j<=S;j++){
int idx = j-(N-i+1);
dp[i][j] = (dp[i-1][j] + (idx >= 0 ? dp[i][idx] : 0)) % MOD;
}
}
printf("%d\n", dp[N][S-K*N*(N-1)/2]);
}
tottoripaper