結果

問題 No.2079 aaabbc
ユーザー tktk_snsntktk_snsn
提出日時 2022-09-26 20:13:59
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 2,335 bytes
コンパイル時間 740 ms
コンパイル使用メモリ 93,996 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-24 03:02:30
合計ジャッジ時間 1,566 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <iomanip>
#include <numeric>
#include <string>
#include <bitset>
#include <assert.h>
#include <functional>

// #define _GLIBCXX_DEBUG
// #define _LIBCPP_DEBUG 0
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define revrep(i, n) for(int i = (int)(n - 1); i >= 0; --i)
#define range(i, s, t) for (int i = (int)(s); i < (int)(t); ++i)
#define revrange(i, s, t) for(int i = (int)(t - 1); i >= (int)(s); --i)
#define srange(i, s, t, step) for(int i = (int)(s); i < (int)(t); i+=int(step))
#define popcnt(x) __builtin_popcountll(x)
#define wakarahen std::ios::sync_with_stdio(false);std::cin.tie(nullptr)

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
template<class T> inline bool chmax(T& a, T b){ if (a < b){ a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b){ if (a > b){ a = b; return true; } return false; }
inline bool inside(int x, int y, int h, int w) { return (x >= 0 && x < h && y >= 0 && y < w); }
int dx[] = {0, -1, 0, 1};
int dy[] = {-1, 0, 1, 0};


const ll mod = 998244353;

ll ext_gcd(ll a, ll b, ll& x, ll& y) {
    if(b==0){ x=1; y=0; return a; }
    ll q = a/b;
    ll d = ext_gcd(b, a-q*b, x, y);
    ll z = x - q*y;
    x = y; y = z;
    return d;
}

ll invmod(ll a, ll p) {
    ll x, y;
    ext_gcd(a, p, x, y);
    x %= p;
    if (x < 0) x+=p;
    return x;
}

ll modpow(ll a, ll n, ll p) {
    if (n==0) return 1LL;
    if (n&1) return modpow(a, n-1, p) * a % p;
    ll tmp = modpow(a, n/2, p);
    return tmp * tmp % p;
}

const int fact_size = 1000000;
ll fact[fact_size], inv[fact_size], factinv[fact_size];
void fact_init() {
    fact[0] = fact[1] = 1;
    for(int i=2; i<fact_size; ++i) fact[i] = fact[i-1] * i % mod;
    factinv[fact_size-1] = modpow(fact[fact_size-1], mod-2, mod);
    for(int i=fact_size-2; i>=0; --i) factinv[i] = factinv[i+1] * (i+1) % mod;
}
ll comb(int n, int k) {
    if (k<0 || k>n) return 0;
    return fact[n] * factinv[k] % mod * factinv[n-k] % mod;
}
ll nPk(int n, int k) {
    if (k<0 || k>n) return 0;
    return fact[n] * factinv[n-k] % mod;
}


int main() {
    ll n;
    cin >> n;
    cout << modpow(3, n, mod) << endl;
}
0