結果
| 問題 |
No.2079 aaabbc
|
| コンテスト | |
| ユーザー |
tktk_snsn
|
| 提出日時 | 2022-09-26 20:13:59 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 2,335 bytes |
| コンパイル時間 | 888 ms |
| コンパイル使用メモリ | 94,656 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-22 15:42:25 |
| 合計ジャッジ時間 | 1,544 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 11 |
ソースコード
#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;
}
tktk_snsn