結果
| 問題 | No.403 2^2^2 |
| コンテスト | |
| ユーザー |
ei1333333
|
| 提出日時 | 2018-11-21 22:46:51 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 479 bytes |
| 記録 | |
| コンパイル時間 | 2,000 ms |
| コンパイル使用メモリ | 210,648 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-07 04:14:46 |
| 合計ジャッジ時間 | 3,293 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
int64_t power(int64_t x, int64_t n, int64_t mod) {
x %= mod;
int64_t ret = 1;
while(n > 0) {
if(n & 1) (ret *= x) %= mod;
(x *= x) %= mod;
n >>= 1;
}
return (ret);
}
const int mod = 1e9 + 7;
int main() {
int64 A, B, C;
scanf("%lld^%lld^%lld", &A, &B, &C);
cout << power(power(A, B, mod), C, mod) << " " << (A % mod == 0 ? 0 : power(A, power(B, C, mod - 1), mod)) << endl;
}
ei1333333