結果

問題 No.657 テトラナッチ数列 Easy
ユーザー 抹茶アイス
提出日時 2023-08-31 16:47:53
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 886 bytes
コンパイル時間 883 ms
コンパイル使用メモリ 104,960 KB
実行使用メモリ 22,912 KB
最終ジャッジ日時 2025-01-03 04:40:56
合計ジャッジ時間 2,303 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Linq;
using System.Numerics;

namespace yukicoder
{
    public class Program
    {
        public static void Main()
        {
            var q = int.Parse(Console.ReadLine());
            var n = new int[q];
            for(var i = 0; i < q; i++)
            {
                n[i] = int.Parse(Console.ReadLine());
            }
            var m = n.Max();
            var a = new int[m];
            if (m > 3)
            {
                a[3] = 1;
                if(m > 4)
                {
                    for (var i = 4; i < m; i++)
                    {
                        a[i] = (a[i - 1] + a[i - 2] + a[i - 3] + a[i - 4]) % 17;
                    }
                }
            }
            foreach(var i in n)
            {
                Console.WriteLine(a[i-1]);
            }
        }
    }
}
0