結果

問題 No.1081 和の和
ユーザー bluemeganebluemegane
提出日時 2020-06-23 10:24:08
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 63 ms / 2,000 ms
コード長 719 bytes
コンパイル時間 857 ms
コンパイル使用メモリ 67,920 KB
実行使用メモリ 23,748 KB
最終ジャッジ日時 2023-09-16 19:48:01
合計ジャッジ時間 2,279 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
21,468 KB
testcase_01 AC 60 ms
21,560 KB
testcase_02 AC 62 ms
21,536 KB
testcase_03 AC 62 ms
23,748 KB
testcase_04 AC 59 ms
19,628 KB
testcase_05 AC 61 ms
19,564 KB
testcase_06 AC 60 ms
21,532 KB
testcase_07 AC 63 ms
23,644 KB
testcase_08 AC 60 ms
23,568 KB
testcase_09 AC 60 ms
21,596 KB
testcase_10 AC 61 ms
21,576 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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;
    }
}
0