結果
| 問題 |
No.754 畳み込みの和
|
| コンテスト | |
| ユーザー |
takeya_okino
|
| 提出日時 | 2019-08-13 20:07:41 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 917 ms / 5,000 ms |
| コード長 | 642 bytes |
| コンパイル時間 | 3,018 ms |
| コンパイル使用メモリ | 83,252 KB |
| 実行使用メモリ | 59,028 KB |
| 最終ジャッジ日時 | 2024-09-19 13:34:40 |
| 合計ジャッジ時間 | 7,593 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 |
ソースコード
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long mod = (long)Math.pow(10, 9) + 7;
long[] a = new long[n + 1];
long[] bsum = new long[n + 1];
for(int i = 0; i < n + 1; i++) {
a[i] = sc.nextLong();
}
bsum[0] = sc.nextLong();
for(int i = 1; i < n + 1; i++) {
long t = sc.nextLong();
bsum[i] = (bsum[i - 1] + t) % mod;
}
long ans = 0;
for(int i = 0; i < n + 1; i++) {
long t = (a[i] * bsum[n - i]) % mod;
ans = (ans + t) % mod;
}
System.out.println(ans);
}
}
takeya_okino