結果
| 問題 |
No.269 見栄っ張りの募金活動
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-08-24 01:15:27 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 5,000 ms |
| コード長 | 282 bytes |
| コンパイル時間 | 294 ms |
| コンパイル使用メモリ | 36,352 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-16 01:34:55 |
| 合計ジャッジ時間 | 1,192 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
5 | scanf("%d%d%d",&N,&S,&K);
| ~~~~~^~~~~~~~~~~~~~~~~~~
ソースコード
#include <vector>
#include <cstdio>
int main(){
int N,S,K,i;
scanf("%d%d%d",&N,&S,&K);
S-=K*(N*~-N/2);
if(S<0)puts("0");
else{
std::vector<int>bag(S+1);
bag[0]=1;
for(int i=1;i<=N;i++)for(int j=i;j<=S;j++)bag[j]=(bag[j-i]+bag[j])%1000000007;
printf("%d\n",bag[S]);
}
}