結果

問題 No.657 テトラナッチ数列 Easy
ユーザー nebukuro09
提出日時 2018-03-03 00:21:50
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 16 ms / 2,000 ms
コード長 496 bytes
コンパイル時間 715 ms
コンパイル使用メモリ 114,816 KB
実行使用メモリ 8,572 KB
最終ジャッジ日時 2024-06-13 00:01:24
合計ジャッジ時間 1,623 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

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