結果
| 問題 | No.403 2^2^2 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-03-14 01:34:32 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 504 bytes |
| 記録 | |
| コンパイル時間 | 915 ms |
| コンパイル使用メモリ | 179,312 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-08-02 02:30:04 |
| 合計ジャッジ時間 | 2,522 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 WA * 7 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
ll modpow(ll x, ll n, ll mod) {
if (x == 0) return 0;
ll res = 1;
while (n > 0) {
if (n & 1) res = res * x % mod;
x = x * x % mod;
n >>= 1;
}
return res;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll a, b, c;
scanf("%lld^%lld^%lld", &a, &b, &c);
cout << modpow(modpow(a, b, MOD), c, MOD);
cout << " ";
cout << modpow(a % MOD, modpow(b, c, MOD - 1), MOD) << endl;
return 0;
}