結果
問題 |
No.8046 yukicoderの過去問
|
ユーザー |
|
提出日時 | 2019-04-07 21:04:03 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 365 bytes |
コンパイル時間 | 354 ms |
コンパイル使用メモリ | 29,824 KB |
最終ジャッジ日時 | 2025-01-07 01:30:04 |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 TLE * 3 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%d%d",&K,&N); | ~~~~~^~~~~~~~~~~~~~ main.cpp:12:34: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | for(int i=0;i<N;i++)scanf("%d",&x[i]); | ~~~~~^~~~~~~~~~~~
ソースコード
#pragma GCC optimize("O3") #pragma GCC target("avx") #include <cstdio> using namespace std; int k[1<<17],x[1<<17]; const int M=1000000007; int main(){ int K,N; scanf("%d%d",&K,&N); k[0]=1; for(int i=0;i<N;i++)scanf("%d",&x[i]); for(int i=1;i<=K;i++)for(int j=0;j<N;j++){ if(i>=x[j]){ k[i]+=k[i-x[j]]; if(k[i]>=M)k[i]-=M; } } printf("%d\n",k[K]); }