結果
| 問題 | No.2299 Antitypoglycemia |
| コンテスト | |
| ユーザー |
as277575
|
| 提出日時 | 2023-05-12 22:30:08 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 574 bytes |
| 記録 | |
| コンパイル時間 | 667 ms |
| コンパイル使用メモリ | 130,620 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-30 15:06:27 |
| 合計ジャッジ時間 | 1,749 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <vector>
#include <set>
using namespace::std;
int main() {
ios::sync_with_stdio(false);
long long n, a, b, m = 998244353;
cin >> n >> a >> b;
vector<long long> f(n + 1);
f[0] = 1;
for (int i = 1; i <= n; ++i) f[i] = (f[i - 1] * i) % m;
long long r = (f[n] + ((m - 2) * f[n - 1]) % m) % m;
if (a != b) r = (r + f[n - 2]) % m;
cout << r << endl;
return 0;
}
as277575