#include <string>
#include <cmath>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <list>
#include <stdio.h>
#include <string.h>
using namespace std;
int main()
{
long long a, b;
int k;
cin >> a >> b;
bool num[100];
a %= 1000000007;
for (int i = 0; i < 100; i++)
{
num[i] = false;
if (b == 0)
{
k = i;
break;
}
if (b % 2 == 1)
num[i] = true;
b /= 2;
}
long long answer = 1;
long long temp;
for (int i = 0; i < k; i++)
{
if (num[i])
{
temp = 1;
for (int j = 0; j < pow(2,i); j++)
{
temp *= a;
temp %= 1000000007;
}
answer *= temp;
answer %= 1000000007;
}
}
cout << answer << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1000 ms |
1908 KB |
Program timed out |
2 |
Halted |
0 ms |
0 KB |
- |