結果

問題 No.2600 Avator Height
ユーザー ぷらぷら
提出日時 2024-01-12 21:59:58
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 51 ms / 2,000 ms
コード長 1,129 bytes
コンパイル時間 1,303 ms
コンパイル使用メモリ 136,108 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-01-12 22:00:04
合計ジャッジ時間 5,069 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
6,548 KB
testcase_01 AC 44 ms
6,548 KB
testcase_02 AC 44 ms
6,548 KB
testcase_03 AC 43 ms
6,676 KB
testcase_04 AC 43 ms
6,676 KB
testcase_05 AC 42 ms
6,676 KB
testcase_06 AC 45 ms
6,676 KB
testcase_07 AC 45 ms
6,676 KB
testcase_08 AC 44 ms
6,676 KB
testcase_09 AC 44 ms
6,676 KB
testcase_10 AC 47 ms
6,676 KB
testcase_11 AC 45 ms
6,676 KB
testcase_12 AC 44 ms
6,676 KB
testcase_13 AC 51 ms
6,676 KB
testcase_14 AC 44 ms
6,676 KB
testcase_15 AC 45 ms
6,676 KB
testcase_16 AC 45 ms
6,676 KB
testcase_17 AC 45 ms
6,676 KB
testcase_18 AC 45 ms
6,676 KB
testcase_19 AC 44 ms
6,676 KB
testcase_20 AC 44 ms
6,676 KB
testcase_21 AC 45 ms
6,676 KB
testcase_22 AC 45 ms
6,676 KB
testcase_23 AC 44 ms
6,676 KB
testcase_24 AC 29 ms
6,676 KB
testcase_25 AC 41 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <string.h>
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;

constexpr int mod = 998244353;

int dp1[200200],dp2[200200];

void mpl(int &x,int y) {
    x += y;
    if(x >= mod) x -= mod;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    dp1[1] = dp2[1] = 1;
    dp1[2] = 1;
    dp2[2] = 3;
    for(int i = 3; i <= 200000; i++) {
        mpl(dp1[i],dp1[i-1]);
        mpl(dp1[i],dp1[i-2]);
        mpl(dp2[i],dp2[i-1]);
        mpl(dp2[i],dp2[i-2]);
    }
    int Q;
    cin >> Q;
    while(Q--) {
        int N;
        cin >> N;
        cout << (5ll*dp1[N]%mod*dp1[N]%mod+mod-1ll*dp2[N]*dp2[N]%mod)%mod << "\n";
    }
}
0