結果
問題 | No.2679 MODice |
ユーザー |
![]() |
提出日時 | 2024-04-26 14:04:42 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,430 bytes |
コンパイル時間 | 505 ms |
コンパイル使用メモリ | 42,060 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-14 02:20:44 |
合計ジャッジ時間 | 1,250 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 15 |
ソースコード
/* -*- coding: utf-8 -*-** 2679.cc: No.2679 MODice - yukicoder*/#include<cstdio>#include<algorithm>using namespace std;/* constant */const int MOD = 998244353;/* typedef */template<const int MOD>struct MI {int v;MI(): v() {}MI(int _v): v(_v % MOD) { if (v < 0) v += MOD; }MI(long long _v): v(_v % MOD) { if (v < 0) v += MOD; }explicit operator int() const { return v; }MI operator+(const MI m) const { return MI(v + m.v); }MI operator-(const MI m) const { return MI(v + MOD - m.v); }MI operator*(const MI m) const { return MI((long long)v * m.v); }MI &operator+=(const MI m) { return (*this = *this + m); }MI &operator-=(const MI m) { return (*this = *this - m); }MI &operator*=(const MI m) { return (*this = *this * m); }bool operator==(const MI m) const { return v == m.v; }bool operator!=(const MI m) const { return v != m.v; }MI pow(int n) const { // a^n % MODMI pm = 1, a = *this;while (n > 0) {if (n & 1) pm *= a;a *= a;n >>= 1;}return pm;}MI inv() const { return pow(MOD - 2); }MI operator/(const MI m) const { return *this * m.inv(); }MI &operator/=(const MI m) { return (*this = *this / m); }};using mi = MI<MOD>;/* gloval variables *//* subroutines *//* main */int main() {int n, k;scanf("%d%d", &n, &k);mi inv6 = mi(6).inv();printf("%d\n", (int)inv6);return 0;}