結果

問題 No.754 畳み込みの和
ユーザー mban
提出日時 2018-12-18 01:34:57
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 129 ms / 5,000 ms
コード長 2,784 bytes
コンパイル時間 859 ms
コンパイル使用メモリ 112,100 KB
実行使用メモリ 31,036 KB
最終ジャッジ日時 2024-09-25 07:39:15
合計ジャッジ時間 1,840 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #
プレゼンテーションモードにする

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Runtime.InteropServices;
namespace Contest
{
class Scanner
{
private string[] line = new string[0];
private int index = 0;
public string Next()
{
if (line.Length <= index)
{
line = Console.ReadLine().Split(' ');
index = 0;
}
var res = line[index];
index++;
return res;
}
public int NextInt()
{
return int.Parse(Next());
}
public long NextLong()
{
return long.Parse(Next());
}
public ulong NextUlong()
{
return ulong.Parse(Next());
}
public string[] Array()
{
line = Console.ReadLine().Split(' ');
index = line.Length;
return line;
}
public int[] IntArray()
{
var array = Array();
var result = new int[array.Length];
for (int i = 0; i < array.Length; i++)
{
result[i] = int.Parse(array[i]);
}
return result;
}
public long[] LongArray()
{
var array = Array();
var result = new long[array.Length];
for (int i = 0; i < array.Length; i++)
{
result[i] = long.Parse(array[i]);
}
return result;
}
}
class Program
{
private int N;
private int[] A, B;
private const long Mod = (long)1e9 + 7;
private long[] BSum;
void Scan()
{
var sc = new Scanner();
N = sc.NextInt();
A = new int[N + 1];
B = new int[N + 1];
for (int i = 0; i <= N; i++)
{
A[i] = sc.NextInt();
}
for (int i = 0; i <= N; i++)
{
B[i] = sc.NextInt();
}
}
private long Sum(int left, int right)
{
return BSum[right] - BSum[left];
}
public void Solve()
{
Scan();
BSum = new long[N + 2];
for (int i = 1; i <= N + 1; i++)
{
BSum[i] = BSum[i - 1] + B[i - 1];
}
long ans = 0;
for (int i = 0; i <= N; i++)
{
ans += (Sum(0, N - i + 1) % Mod) * A[i];
//Console.WriteLine($"{i} {N + 1} {Sum(i, N + 1)}");
ans %= Mod;
}
Console.WriteLine(ans);
}
static void Main() => new Program().Solve();
}
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0