結果
問題 |
No.8046 yukicoderの過去問
|
ユーザー |
👑 |
提出日時 | 2019-04-01 23:55:46 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 483 bytes |
コンパイル時間 | 339 ms |
コンパイル使用メモリ | 29,568 KB |
最終ジャッジ日時 | 2025-01-07 01:15:16 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 TLE * 3 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:16:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 16 | scanf("%d", &K); | ~~~~~^~~~~~~~~~ main.cpp:17:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 17 | scanf("%d", &N); | ~~~~~^~~~~~~~~~ main.cpp:19:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 19 | scanf("%d", &X[i]); | ~~~~~^~~~~~~~~~~~~
ソースコード
#pragma GCC optimize ("O3") #pragma GCC target ("avx") #include <stdio.h> using Int = long long; constexpr Int MO = 1000000007; int K, N; int X[100010]; Int dp[100010]; int main() { scanf("%d", &K); scanf("%d", &N); for (int i = 0; i < N; ++i) { scanf("%d", &X[i]); } X[N] = K + 1; dp[0] = 1; for (int x = 1; x <= K; ++x) { for (int i = 0; X[i] <= x; ++i) { dp[x] += dp[x - X[i]]; } dp[x] %= MO; } printf("%lld\n", dp[K]); return 0; }