結果

問題 No.754 畳み込みの和
ユーザー t33ft33f
提出日時 2018-12-06 19:11:51
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 77 ms / 5,000 ms
コード長 442 bytes
コンパイル時間 440 ms
コンパイル使用メモリ 52,344 KB
実行使用メモリ 4,972 KB
最終ジャッジ日時 2023-10-12 02:49:55
合計ジャッジ時間 1,266 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
4,908 KB
testcase_01 AC 77 ms
4,972 KB
testcase_02 AC 77 ms
4,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

int main() {
    int n; cin >> n;
    long long a[n+1], b[n+1];
    for (int i = 0; i <= n; i++) cin >> a[i];
    for (int i = 0; i <= n; i++) cin >> b[i];
    long long s = 0, ans = 0;
    const long long M = 1000000007;
    for (int i = 0; i <= n; i++) {
        s += b[i];
        if (s >= M) s -= M;
        ans += a[n-i] * s % M;
        if (ans >= M) ans -= M;
    }
    cout << ans << endl;
}
0