結果

提出番号 1031
提出者 tone_back
言語 C++
提出日時 2017-08-17 00:13:09
問題名 (48)暑中見舞い
結果 AC
点数 100%

テストケース

テストケース 結果 得点 実行時間 メモリ使用量
1 AC 100% 2ms 8368KB
2 AC 100% 24ms 8304KB
3 AC 100% 2ms 7920KB
4 AC 100% 13ms 8336KB
5 AC 100% 3ms 8288KB
6 AC 100% 3ms 7744KB
7 AC 100% 24ms 7440KB

ソースコード

#define _USE_MATH_DEFINES
#include <iostream>
#include <math.h>
#include <climits>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <map> 
#include <set>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MD = 1000000007;

/* sample input

*/

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

int main()
{
	ll a, n;
	ll answer;
	cin >> a >> n;
	//a^n%MDを求める?

	answer = a;

	/*
	for (ll i = 0; i < n - 1; i++) {
		answer = (answer*a) % MD;
	}
	*/

	cout << mod_pow(a,n,MD);

	return 0;
}