結果

問題 No.2600 Avator Height
ユーザー InTheBloomInTheBloom
提出日時 2024-01-12 21:26:26
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 728 bytes
コンパイル時間 5,475 ms
コンパイル使用メモリ 160,992 KB
実行使用メモリ 10,644 KB
最終ジャッジ日時 2024-01-12 21:27:00
合計ジャッジ時間 7,150 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
6,548 KB
testcase_01 AC 115 ms
10,644 KB
testcase_02 AC 129 ms
10,644 KB
testcase_03 AC 117 ms
10,644 KB
testcase_04 AC 114 ms
10,644 KB
testcase_05 AC 116 ms
10,644 KB
testcase_06 AC 117 ms
10,644 KB
testcase_07 AC 114 ms
10,644 KB
testcase_08 AC 116 ms
10,644 KB
testcase_09 AC 116 ms
10,644 KB
testcase_10 AC 115 ms
10,644 KB
testcase_11 AC 115 ms
10,644 KB
testcase_12 AC 112 ms
10,644 KB
testcase_13 AC 114 ms
10,644 KB
testcase_14 AC 115 ms
10,644 KB
testcase_15 AC 112 ms
10,644 KB
testcase_16 AC 113 ms
10,644 KB
testcase_17 AC 118 ms
10,644 KB
testcase_18 AC 115 ms
10,644 KB
testcase_19 AC 116 ms
10,644 KB
testcase_20 AC 116 ms
10,644 KB
testcase_21 AC 115 ms
10,644 KB
testcase_22 AC 115 ms
10,644 KB
testcase_23 AC 117 ms
10,644 KB
testcase_24 AC 119 ms
10,644 KB
testcase_25 AC 106 ms
10,644 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;

void main () {
    // 前計算
    const long MOD = 998244353;
    const int MAX = 2*10^^5;
    long[] R = new long[](MAX+1);
    long[] E = new long[](MAX+1);
    R[1] = R[2] = 1;
    E[1] = 1, E[2] = 3;

    for (int i = 3; i <= MAX; i++) {
        R[i] = (R[i-1] + R[i-2]) % MOD;
        E[i] = (E[i-1] + E[i-2]) % MOD;
    }

    int Q = readln.chomp.to!int;
    foreach (_; 0..Q) {
        int N = readln.chomp.to!int;
        long r = R[N] * R[N] % MOD;
        long e = E[N] * E[N] % MOD;
        r = r * 5 % MOD;
        writeln((MOD + r - e) % MOD);
    }
}

void read (T...) (string S, ref T args) {
    auto buf = S.split;
    foreach (i, ref arg; args) {
        arg = buf[i].to!(typeof(arg));
    }
}
0