結果
| 問題 | No.1081 和の和 |
| コンテスト | |
| ユーザー |
bluemegane
|
| 提出日時 | 2020-06-23 10:24:08 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 29 ms / 2,000 ms |
| コード長 | 719 bytes |
| 記録 | |
| コンパイル時間 | 824 ms |
| コンパイル使用メモリ | 113,352 KB |
| 実行使用メモリ | 26,912 KB |
| 最終ジャッジ日時 | 2024-07-03 19:10:47 |
| 合計ジャッジ時間 | 1,670 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System.Linq;
using System.Collections.Generic;
using System;
public class Hello
{
public static int MOD = 1000000007;
static void Main()
{
var n = int.Parse(Console.ReadLine().Trim());
string[] line = Console.ReadLine().Trim().Split(' ');
var a = Array.ConvertAll(line, long.Parse).ToList();
getAns(a);
}
static void getAns(List<long> a)
{
while (a.Count() > 1) a = calc(a);
Console.WriteLine(a[0]);
}
static List<long> calc(List<long> a)
{
var res = new List<long>();
var acount = a.Count();
for (int i = 0; i < acount - 1; i++)
res.Add((a[i] + a[i + 1]) % MOD);
return res;
}
}
bluemegane