結果

問題 No.3515 Anti EIKO
コンテスト
ユーザー Nakama Kazuki
提出日時 2026-06-27 21:18:59
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 886 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,067 ms
コンパイル使用メモリ 175,456 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-06-27 21:19:03
合計ジャッジ時間 2,627 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 3 WA * 28
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

typedef long long ll;
const ll MOD = 998244353;
ll power(ll base, ll exp) {
    ll res = 1;
    base %= MOD;
    while (exp > 0) {
        if (exp % 2 == 1) {
            res = (res * base) % MOD;
        }
        base = (base * base) % MOD;
        exp /= 2;
    }
    return res;
}
ll modInverse(ll n) {
    // 5のモジュラ逆元を求める: 5^(MOD - 2) mod MOD
    return power(n, MOD - 2);
}

void solve() {
    ll N_val, K_val;
    if (!(cin >> N_val >> K_val)) return;
    ll required_length = 4 * N_val;
    if (K_val < required_length) {
        cout << 0 << endl;
        return;
    }
    ll inv_5 = modInverse(5);
    ll result = power(inv_5, required_length);

    cout << result << endl;
}

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

    solve();

    return 0;
}
0