結果

問題 No.403 2^2^2
ユーザー kk
提出日時 2021-03-01 21:11:07
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 710 bytes
コンパイル時間 2,329 ms
コンパイル使用メモリ 194,568 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-14 03:50:00
合計ジャッジ時間 3,634 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 2 ms
6,944 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 2 ms
6,944 KB
testcase_20 AC 2 ms
6,940 KB
testcase_21 AC 2 ms
6,944 KB
testcase_22 AC 2 ms
6,940 KB
testcase_23 AC 2 ms
6,940 KB
testcase_24 AC 2 ms
6,940 KB
testcase_25 WA -
testcase_26 AC 2 ms
6,940 KB
testcase_27 AC 2 ms
6,940 KB
testcase_28 AC 2 ms
6,940 KB
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

const long long MOD = 1e9 + 7;

long long modpow(long long x, long long p, long long mod) {
  long long ret = 1;
  while (p) {
    if (p & 1)
      ret = ret * x % mod;
    x = x * x % mod;
    p >>= 1;
  }
  return ret;
}

long long solve1(long long a, long long b, long long c) {
  return modpow(modpow(a % MOD, b, MOD), c, MOD);
}

long long solve2(long long a, long long b, long long c) {
  return modpow(a % MOD, modpow(b % (MOD-1), c, MOD-1), MOD);
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  long long a, b, c;
  char _;
  cin >> a >> _ >> b >> _ >> c;
  
  cout << solve1(a, b, c) << " " << solve2(a, b, c) << endl;
  
  return 0;
}
0