結果
| 問題 |
No.269 見栄っ張りの募金活動
|
| コンテスト | |
| ユーザー |
tottoripaper
|
| 提出日時 | 2015-11-20 22:34:32 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 10 ms / 5,000 ms |
| コード長 | 438 bytes |
| コンパイル時間 | 433 ms |
| コンパイル使用メモリ | 23,808 KB |
| 実行使用メモリ | 9,216 KB |
| 最終ジャッジ日時 | 2024-07-16 01:51:37 |
| 合計ジャッジ時間 | 1,412 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
コンパイルメッセージ
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;
}
}
int p = S-K*N*(N-1)/2;
if(p >= 0){
printf("%d\n", dp[N][p]);
}else{
puts("0");
}
}
tottoripaper