結果

問題 No.2600 Avator Height
ユーザー lumidlumid
提出日時 2024-01-12 22:04:59
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 52 ms / 2,000 ms
コード長 1,548 bytes
コンパイル時間 2,048 ms
コンパイル使用メモリ 201,920 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-01-12 22:05:12
合計ジャッジ時間 6,098 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
#include <climits>
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long double ld;
typedef pair<ll, ll> pll;
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define ROF(i, a, b) for(int i = a; i >= b; i--)
#define ms memset
#define pb push_back
#define fi first
#define se second
#define inp(n, a) vector<ll> a;for(int i=0;i<n;i++){ll now;cin>>now;a.pb(now);}
#define all(a) a.begin(),a.end()
#define show(a) for(long long loppls=0;loppls<(long long)(a.size()-1);loppls++)cout<<a[loppls]<<' ';cout<<a[a.size()-1];

long long binpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

ll sum2(ll a, ll l, ll n){return (n*(a+l))/2;}
ll ceil2(ll a, ll b){return (a+b-1)/b;}

const long long INF=1e16,MAX=200020,MOD=998244353;

void solve() {
    ll q;cin>>q;
    ll r[MAX],e[MAX];
    r[1]=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;
    }
    while(q--){
        ll x;cin>>x;
        //cout<<r[x]<<' '<<e[x]<<'\n';
        ll ans=(((5*((r[x]%MOD)*(r[x]%MOD))%MOD)%MOD)-((((e[x])%MOD)*((e[x])%MOD))%MOD))%MOD;
        cout<<(ans<0?MOD+ans:ans)<<'\n';
    }
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);

	solve();
}
0