結果

問題 No.2365 Present of good number
ユーザー a01sa01toa01sa01to
提出日時 2023-06-30 22:00:33
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 743 bytes
コンパイル時間 2,102 ms
コンパイル使用メモリ 198,080 KB
最終ジャッジ日時 2025-02-15 03:52:58
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 1 WA * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

#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)

#include <atcoder/modint>
using mint = atcoder::modint1000000007;

int main() {
  ll n, k;
  cin >> n >> k;
  vector<pair<ll, ll>> 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 });
  mint ans = 1;
  for (auto [p, e] : pf) {
    ans *= mint(p + (k % p)).pow((mint(e) * mint(2).pow(k / p)).val());
  }
  cout << ans.val() << endl;
  return 0;
}
0