結果

問題 No.403 2^2^2
コンテスト
ユーザー DAyamaCTF
提出日時 2016-07-25 08:01:04
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 812 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,048 ms
コンパイル使用メモリ 174,232 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-05-06 20:55:09
合計ジャッジ時間 2,282 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

// g++ -std=c++11 temp.cpp
#include <bits/stdc++.h>
using namespace std;

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define EACH(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3

#define MAX_N 1000

ll a,b,c;
const ll M = 1000000007;

ll mpow(ll a, ll b, ll m){
	if(a%m==0) return 0;
	if(b == 0) return 1;
	ll res = mpow(a*a%m, b/2, m);
	if(b&1) res = res*a%m;
	return res;
}

int main(){
	scanf("%lld^%lld^%lld", &a,&b,&c);
	//dbg(mpow(2000000014,10,M));
	cout<<mpow(mpow(a,b,M),c,M)<<" "<<mpow(a,mpow(b,c,M-1),M)<<endl;
	return 0;
}


0