結果
問題 | No.754 畳み込みの和 |
ユーザー |
![]() |
提出日時 | 2018-12-02 17:49:11 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 105 ms / 5,000 ms |
コード長 | 598 bytes |
コンパイル時間 | 1,059 ms |
コンパイル使用メモリ | 125,568 KB |
実行使用メモリ | 12,128 KB |
最終ジャッジ日時 | 2024-06-13 01:56:48 |
合計ジャッジ時間 | 1,870 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 |
ソースコード
import std.stdio, std.conv, std.string, std.bigint; import std.math, std.random, std.datetime; import std.array, std.range, std.algorithm, std.container; string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; } const long mod = 1_000_000_007; void main(){ int n = read.to!int; long[] as, bs; foreach(i; 0 .. n + 1) as ~= read.to!long; foreach(i; 0 .. n + 1) bs ~= read.to!long; long ans = 0; long sum = 0; foreach(i; 0 .. n + 1){ sum += as[i]; sum %= mod; ans += sum * bs[n - i]; ans %= mod; } ans.writeln; }