結果

問題 No.657 テトラナッチ数列 Easy
ユーザー 抹茶アイス抹茶アイス
提出日時 2023-08-31 16:47:53
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 116 ms / 2,000 ms
コード長 886 bytes
コンパイル時間 2,301 ms
コンパイル使用メモリ 104,984 KB
実行使用メモリ 26,860 KB
最終ジャッジ日時 2023-08-31 16:47:59
合計ジャッジ時間 5,188 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
21,484 KB
testcase_01 AC 58 ms
21,384 KB
testcase_02 AC 58 ms
21,364 KB
testcase_03 AC 57 ms
21,360 KB
testcase_04 AC 71 ms
24,464 KB
testcase_05 AC 95 ms
21,436 KB
testcase_06 AC 57 ms
23,416 KB
testcase_07 AC 57 ms
21,436 KB
testcase_08 AC 72 ms
26,860 KB
testcase_09 AC 98 ms
23,524 KB
testcase_10 AC 102 ms
19,404 KB
testcase_11 AC 98 ms
21,464 KB
testcase_12 AC 99 ms
21,440 KB
testcase_13 AC 114 ms
24,768 KB
testcase_14 AC 114 ms
24,800 KB
testcase_15 AC 116 ms
26,796 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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