結果

問題 No.403 2^2^2
ユーザー 👑 はまやんはまやんはまやんはまやん
提出日時 2016-07-22 23:12:25
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 683 bytes
コンパイル時間 1,575 ms
コンパイル使用メモリ 162,692 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-24 02:36:47
合計ジャッジ時間 2,082 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)




typedef long long ll;
ll modpow(ll a, ll n, ll MOD) {
	a %= MOD;
	ll r = 1;
	while (n) r = r*((n % 2) ? a : 1) % MOD, a = a*a%MOD, n >>= 1;
	return r;
}
//-----------------------------------------------------------------
ll A, B, C;
ll mod = 1000000007;
ll solve1() {
	ll D = ((A % (mod - 1)) * (B % (mod - 1))) % (mod - 1);
	return modpow(A, D, mod);
}
ll solve2() {
	ll D = modpow(B, C, mod - 1);
	return modpow(A, D, mod);
}
//-----------------------------------------------------------------
int main()
{
	scanf("%lld^%lld^%lld", &A, &B, &C);
	cout << solve1() << " " << solve2() << endl;
}
0