結果
問題 | No.2365 Present of good number |
ユーザー |
![]() |
提出日時 | 2023-06-30 21:56:24 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 900 bytes |
コンパイル時間 | 2,099 ms |
コンパイル使用メモリ | 197,156 KB |
最終ジャッジ日時 | 2025-02-15 03:50:30 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 1 WA * 38 |
ソースコード
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #define _GLIBCXX_DEBUG #else #define Debug(...) void(0) #endif using ll = long long; #define rep(i, n) for (int i = 0; i < (n); ++i) constexpr ll MOD = 1e9 + 7; inline ll modpow(ll a, ll x) { ll res = 1; a %= MOD; x %= MOD; while (x > 0) { if (x & 1) { res *= a; res %= MOD; } a *= a; a %= MOD; x >>= 1; } return res; } int main() { ll n, k; cin >> n >> k; vector<pair<ll, int>> pf(0); for (int i = 2; i * i <= n; ++i) { if (n % i == 0) { pf.push_back({ i, 0 }); while (n % i == 0) { n /= i; pf.back().second++; } } } if (n > 1) pf.push_back({ n, 1 }); ll ans = 1; for (auto [p, e] : pf) { ans *= modpow(p + (k % p), e * modpow(2, k / p)); ans %= MOD; } cout << ans << endl; return 0; }