結果
| 問題 |
No.2299 Antitypoglycemia
|
| コンテスト | |
| ユーザー |
ぷら
|
| 提出日時 | 2023-05-12 22:44:46 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 517 bytes |
| コンパイル時間 | 1,820 ms |
| コンパイル使用メモリ | 193,132 KB |
| 最終ジャッジ日時 | 2025-02-12 23:23:29 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
constexpr int mod = 998244353;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int ans = 1;
int n,a,b;
cin >> n >> a >> b;
if(a != b) {
ans = (n-1)+1ll*(n-2)*(n-2)%mod;
ans %= mod;
for(int i = 1; i <= n-2; i++) {
ans = 1ll*ans*i%mod;
}
}
else {
ans = (n-2);
for(int i = 1; i <= n-1; i++) {
ans = 1ll*ans*i%mod;
}
}
cout << ans << "\n";
}
ぷら