結果
| 問題 |
No.2380 Sylow P-subgroup
|
| ユーザー |
shirokami
|
| 提出日時 | 2023-07-14 21:37:44 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 2,129 bytes |
| コンパイル時間 | 6,087 ms |
| コンパイル使用メモリ | 358,372 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-16 06:30:05 |
| 合計ジャッジ時間 | 6,791 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 |
ソースコード
#include <bits/extc++.h>
using namespace std;
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
// using namespace __gnu_pbds;
// #include <boost/multiprecision/cpp_int.hpp>
// using Bint = boost::multiprecision::cpp_int;
#include <atcoder/all>
using namespace atcoder;
// https://atcoder.github.io/ac-library/production/document_ja/
typedef long long int ll;
typedef long double ld;
constexpr ll mod = 998244353;
constexpr ll INF = 9'223'372'036'854'775'807/10;
#define rep(i,n) for (ll i = 0; i < ll(n); ++i)
#define All(a) (a).begin(),(a).end()
#define Pi acos(-1)
using V = vector<ll>;
using P = pair<ll,ll>;
vector<ll> dx = {1, 0, -1, 0, 1, 1, -1, -1};
vector<ll> dy = {0, 1, 0, -1, 1, -1, 1, -1};
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
struct Edge{ll to, cost;};
using Graph = vector<vector<Edge>>;
struct IoSetup {
IoSetup() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
cout << setprecision(15) << fixed;
}
} iosetup;
void print(vector<string> &v) {
for (string s : v) {
cout << s << '\n';
}
}
template<typename T>
void print(vector<pair<T, T>> &v, int w = 0) {
for (int i = 0; i < (int)v.size(); i++) {
cout << right << setw(w) << v[i].first << ' ' << v[i].second << '\n';
}
}
template<typename T>
void print(vector<T> &v, int w = 0) {
for (int i = 0; i < (int)v.size(); i++) {
cout << right << setw(w) << v[i] << " \n"[i == (int)v.size() - 1];
}
}
template<typename T>
void print(vector<vector<T>> &v, int w = 0) {
for (int i = 0; i < (int)v.size(); i++) {
print(v[i], w);
}
}
template<typename T>
void print(const T& arg) {
cout << arg << '\n';
}
template<typename T, typename... Args>
void print(const T& arg, const Args&... args) {
cout << arg << ' ';
print(args...);
}
using mint = modint998244353;
ll f(ll n, ll p) {
ll res = 0;
while (n) {
res += n / p;
n /= p;
}
return res;
}
int main() {
ll n, p;
cin >> n >> p;
mint ans = mint(p).pow(f(n, p));
print(ans.val());
}
shirokami