結果
問題 |
No.269 見栄っ張りの募金活動
|
ユーザー |
|
提出日時 | 2015-08-24 01:14:54 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 283 bytes |
コンパイル時間 | 473 ms |
コンパイル使用メモリ | 36,096 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-18 13:07:03 |
合計ジャッジ時間 | 934 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 17 WA * 5 |
コンパイルメッセージ
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("-1"); 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]); } }