結果
| 問題 |
No.2351 Butterfly in Summer
|
| コンテスト | |
| ユーザー |
sorachandu
|
| 提出日時 | 2023-06-17 01:44:19 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 14 ms / 2,000 ms |
| コード長 | 1,720 bytes |
| コンパイル時間 | 4,066 ms |
| コンパイル使用メモリ | 250,944 KB |
| 最終ジャッジ日時 | 2025-02-14 21:50:51 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
// clang-format off
struct Init { Init() { ios::sync_with_stdio(0); cin.tie(0); cout << setprecision(13); } }init;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vector<int>> Graph;
#define rep(i, x, limit) for (int i = (int)x; i < (int)limit; i++)
#define REP(i, x, limit) for (int i = (int)x; i <= (int)limit; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define el '\n'
#define spa " "
#define YES cout << "Yes" << el
#define NO cout << "No" << el
#define eps (1e-10)
#define Equals(a,b) (fabs((a) - (b)) < eps )
const double pi = 3.141592653589793238;
const int inf = 1073741823;
const ll infl = 1LL << 60;
//配列の要素を空白区切りで出力
template<class T> inline void print_vec(const vector<T>& v) {
if(v.empty()){
cout << "This vector is empty." << el;
return;
}
for (int i = 0; i < v.size(); i++) {
if(v[i]==inf || v[i]==infl) cout << 'x' << spa;
else cout << v[i] << spa;
}
cout << el;
}
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;
}
// clang-format on
typedef modint998244353 mint;
//--------------------------------------------------------
int main() {
ll n,k;
cin >> n >> k;
mint inv = mint(1)/k;
mint ans = inv.pow(n) * mint(k-1) * n * k;
cout << ans.val() << el;
}
sorachandu