結果

問題 No.657 テトラナッチ数列 Easy
ユーザー nebukuro09nebukuro09
提出日時 2018-03-03 00:21:50
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 496 bytes
コンパイル時間 785 ms
コンパイル使用メモリ 99,640 KB
実行使用メモリ 8,112 KB
最終ジャッジ日時 2023-09-03 18:55:31
合計ジャッジ時間 1,745 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,700 KB
testcase_01 AC 11 ms
6,736 KB
testcase_02 AC 11 ms
7,136 KB
testcase_03 AC 11 ms
8,112 KB
testcase_04 AC 11 ms
7,504 KB
testcase_05 AC 15 ms
7,444 KB
testcase_06 AC 10 ms
6,748 KB
testcase_07 AC 11 ms
6,728 KB
testcase_08 AC 11 ms
6,916 KB
testcase_09 AC 15 ms
7,392 KB
testcase_10 AC 15 ms
7,548 KB
testcase_11 AC 15 ms
7,432 KB
testcase_12 AC 16 ms
6,712 KB
testcase_13 AC 15 ms
7,116 KB
testcase_14 AC 17 ms
6,920 KB
testcase_15 AC 16 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

immutable long INF = 1L << 59;

void main() {
    auto T = new int[](10^^6+1);

    T[4] = 1;

    foreach (i; 5..10^^6+1) {
        T[i] = T[i-1] + T[i-2] + T[i-3] + T[i-4];
        T[i] %= 17;
    }

    auto Q = readln.chomp.to!int;
    while (Q--) {
        T[readln.chomp.to!int].writeln;
    }
}
0