結果
問題 |
No.754 畳み込みの和
|
ユーザー |
![]() |
提出日時 | 2023-08-21 20:48:25 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 569 bytes |
コンパイル時間 | 1,215 ms |
コンパイル使用メモリ | 103,108 KB |
最終ジャッジ日時 | 2025-02-16 12:06:33 |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | TLE * 1 -- * 2 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:23:17: warning: ‘ans’ may be used uninitialized [-Wmaybe-uninitialized] 23 | ans += (a[j] * b[i-j])%mod; | ~~~~^~~~~~~~~~~~~~~~~~~~~~ main.cpp:14:23: note: ‘ans’ was declared here 14 | long long n, mod, ans; | ^~~
ソースコード
#include<iostream> #include<map> #include<vector> #include <algorithm> #include<math.h> #include <iomanip> #include<set> #include <numeric> using namespace std; int main() { long long n, mod, ans; cin >> n; mod = 1e9+7; vector<long long> a(n+1), b(n+1); for (long long i = 0; i < n+1; i++) cin >> a[i]; for (long long i = 0; i < n+1; i++) cin >> b[i]; for (long long i = 0; i < n+1; i++){ for (int j = 0; j <= i; j++){ ans += (a[j] * b[i-j])%mod; ans %= mod; } } cout << ans << endl; }