結果
問題 | No.754 畳み込みの和 |
ユーザー | takeya_okino |
提出日時 | 2019-08-13 20:07:41 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 861 ms / 5,000 ms |
コード長 | 642 bytes |
コンパイル時間 | 2,849 ms |
コンパイル使用メモリ | 74,048 KB |
実行使用メモリ | 72,912 KB |
最終ジャッジ日時 | 2023-10-19 17:16:09 |
合計ジャッジ時間 | 6,420 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 834 ms
72,256 KB |
testcase_01 | AC | 861 ms
72,432 KB |
testcase_02 | AC | 827 ms
72,912 KB |
ソースコード
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); } }