結果
| 問題 |
No.754 畳み込みの和
|
| コンテスト | |
| ユーザー |
vis103
|
| 提出日時 | 2018-12-14 12:21:32 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 103 ms / 5,000 ms |
| コード長 | 1,017 bytes |
| コンパイル時間 | 867 ms |
| コンパイル使用メモリ | 108,760 KB |
| 実行使用メモリ | 30,836 KB |
| 最終ジャッジ日時 | 2024-09-25 04:59:54 |
| 合計ジャッジ時間 | 1,742 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
class Program
{
static void Main()
{
int n = int.Parse(Console.ReadLine()) + 1;
ulong[] a = new ulong[n];
ulong[] b = new ulong[n];
ulong bAccumulation = 0;
ulong Remainder = 1000000007;
for (int i = 0; i < n; i++)
{
b[i] = ulong.Parse(Console.ReadLine());
bAccumulation += b[i];
bAccumulation %= Remainder;
}
for (int i = 0; i < n; i++)
{
a[i] = ulong.Parse(Console.ReadLine());
}
ulong Sum = 0;
for(int i = 0; i < n; i++)
{
Sum += a[i] * bAccumulation;
Sum %= Remainder;
if (bAccumulation < b[b.Length - i - 1])
{
bAccumulation += Remainder;
bAccumulation -= b[b.Length - i - 1];
}
else
{
bAccumulation -= b[b.Length - i - 1];
}
}
Console.WriteLine(Sum);
}
}
vis103