結果

問題 No.1081 和の和
ユーザー Yusei Kato
提出日時 2020-06-22 20:08:35
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 1,131 bytes
コンパイル時間 980 ms
コンパイル使用メモリ 115,244 KB
実行使用メモリ 27,276 KB
最終ジャッジ日時 2024-07-03 18:45:09
合計ジャッジ時間 1,885 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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.

ソースコード

diff #

using System;
using System.Linq;

namespace Problem1081
{
    class Program
    {
        static void Main(string[] args)
        {
            const long mod = 7 + (long)1e9;
            int N = GetInt();
            var A = GetLongArray();

            for(int i = 0; i < N - 1; i++)
            {
                var Anext = new long[A.Length - 1];
                for(int j = 0; j < Anext.Length; j++)
                {
                    Anext[j] = (A[j] + A[j + 1]) % mod;
                }
                A = Anext;
            }

            Console.WriteLine(A[0]);
        }

        public static int GetInt() => int.Parse(Console.ReadLine());
        public static int[] GetIntArray() => Console.ReadLine().Split().Select(int.Parse).ToArray();
        public static double GetDouble() => double.Parse(Console.ReadLine());
        public static double[] GetDoubleArray() => Console.ReadLine().Split().Select(double.Parse).ToArray();
        public static long GetLong() => long.Parse(Console.ReadLine());
        public static long[] GetLongArray() => Console.ReadLine().Split().Select(long.Parse).ToArray();

    }
}
0