結果
| 問題 |
No.403 2^2^2
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-03-14 01:34:32 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 504 bytes |
| コンパイル時間 | 1,453 ms |
| コンパイル使用メモリ | 166,520 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-30 00:41:36 |
| 合計ジャッジ時間 | 2,404 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
}