結果

問題 No.2079 aaabbc
ユーザー AngrySadEight
提出日時 2022-09-03 01:41:22
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 424 bytes
コンパイル時間 565 ms
コンパイル使用メモリ 67,688 KB
最終ジャッジ日時 2025-02-07 02:04:07
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
typedef long long ll;

ll my_pow(ll x, ll n, ll mod){
    ll ret;
    if (n == 0){
        ret = 1;
    }
    else if (n % 2 == 0){
        ret = my_pow((x * x) % mod, n / 2, mod);
    }
    else{
        ret = (x * my_pow((x * x) % mod, n / 2, mod)) % mod;
    }
    return ret;
}

int main(){
    ll N;
    cin >> N;
    ll mod = 998244353;
    cout << my_pow(3, N, mod) << endl;
}
0