結果

問題 No.403 2^2^2
ユーザー fine
提出日時 2017-03-14 01:31:11
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 475 bytes
コンパイル時間 1,455 ms
コンパイル使用メモリ 166,788 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-30 00:41:49
合計ジャッジ時間 2,363 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const ll MOD = 1e9 + 7;

ll modpow(ll x, ll n, ll mod) {
	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, modpow(b, c, MOD - 1), MOD) << endl;
	return 0;
}
0