結果

問題 No.403 2^2^2
ユーザー bal4ubal4u
提出日時 2019-04-15 06:01:57
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 847 bytes
コンパイル時間 831 ms
コンパイル使用メモリ 30,272 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-21 21:05:37
合計ジャッジ時間 2,364 ms
ジャッジサーバーID
(参考情報)
judge11 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

// yukicoder: No.403 2^2^2
// 2019.4.15 bal4u

#include <stdio.h>
#include <ctype.h>

#if 0
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
long long in()    // 非負整数の入力
{
	long long n = 0; int c = gc();
	do n = 10 * n + (c & 0xf), c = gc(); while (isdigit(c));
	return n;
}

#define MOD 1000000007

int bigPow(int x, long long p, int mod)
{
	int r = 1;
	while (p) {
		if (p & 1) r = (long long)r * x % mod;
		x = (long long)x * x % mod;
		p >>= 1;
	}
	return r;
}

int main()
{
	long long A, B, C, t;
	int ans1, ans2;

	A = in(), B = in(), C = in();
	if (A == 1) { puts("1 1"); return 0; }
	
	A %= MOD;
	t = ((B % (MOD - 1))*(C % (MOD - 1))) % (MOD - 1);
	ans1 = bigPow((int)A, t, MOD);

	B %= MOD - 1;
	t = bigPow((int)B, C, MOD - 1);
	ans2 = bigPow((int)A, t, MOD);

	printf("%d %d\n", ans1, ans2);
	return 0;
}
0