結果
問題 | No.754 畳み込みの和 |
ユーザー |
![]() |
提出日時 | 2018-12-06 11:44:19 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 25 ms / 5,000 ms |
コード長 | 811 bytes |
コンパイル時間 | 933 ms |
コンパイル使用メモリ | 85,320 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-14 02:23:48 |
合計ジャッジ時間 | 1,571 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 |
ソースコード
#define _USE_MATH_DEFINES#include<iostream>#include<vector>#include<algorithm>#include<cmath>#include<string>#include<iomanip>#include<cassert>#include<functional>int main(){std::ios::sync_with_stdio(false);std::cin.tie(0);const long long subtract = 1000000007;long long n;long long temp_b;long long temp_b_sum = 0;long long ans = 0;std::cin >> n;std::vector<long long> a(n + 1);std::vector<long long> b_sum(n + 1);for (long long i = 0; i < n + 1; i++){std::cin >> a[i];}for (long long i = 0; i < n + 1; i++){std::cin >> temp_b;temp_b_sum += temp_b;temp_b_sum %= subtract;b_sum[i] = temp_b_sum;}//入力終わりfor (long long i = 0; i < n + 1; i++){ans += a[i] * b_sum[n - i];ans = ans % subtract;}std::cout << ans << '\n';return 0;}