結果

問題 No.403 2^2^2
コンテスト
ユーザー femto
提出日時 2016-07-23 00:46:32
言語 C++11
(gcc 15.3.0 + boost 1.92.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 2,000 ms
+ 359µs
コード長 672 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 339 ms
コンパイル使用メモリ 86,544 KB
実行使用メモリ 10,044 KB
最終ジャッジ日時 2026-09-19 18:22:20
合計ジャッジ時間 1,968 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cassert>
using namespace std;
typedef long long ll;

const int mod = 1000000007;

ll modpow(ll x, ll n, ll mod) {
	x %= mod;
	if(n == 0) return 1;
	ll res = modpow(x * x % mod, n / 2, mod);
	if(n & 1) res = res * x % mod;
	return res;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	ll A, B, C;
	char c;

	cin >> A >> c >> B >> c >> C;

	if(A % mod == 0) {
		cout << "0 0" << endl;
		return 0;
	}

	ll ans1 = modpow(modpow(A, B, mod), C, mod);
	ll ans2 = modpow(A, modpow(B, C, mod - 1), mod);

	cout << ans1 << " " << ans2 << endl;
}
0