結果

問題 No.2299 Antitypoglycemia
コンテスト
ユーザー srjywrdnprkt
提出日時 2023-05-12 21:40:51
言語 C++17
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 3 ms / 2,000 ms
+ 18µs
コード長 673 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 654 ms
コンパイル使用メモリ 132,152 KB
実行使用メモリ 9,920 KB
最終ジャッジ日時 2026-10-14 22:15:39
合計ジャッジ時間 2,459 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>

using namespace std;
using ll = long long;

int main(){

    const ll modc = 998244353;
    ll N, A, B;
    cin >> N >> A >> B;
    vector<ll> p(N+1);
    p[0] = 1;
    p[1] = 1;
    for (ll i=2; i<=N; i++){
        p[i] = (p[i-1] * i) % modc;
        p[i] %= modc;
    }

    if (A != B){
        cout << (p[N] + modc*2 - p[N-1]*2 + p[N-2]) % modc << endl;
    }
    else{
        cout << (p[N] + modc*2 - p[N-1]*2) % modc << endl;
    }

    return 0;
}
0