# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
19521 | panda959595 | Α (kriii4_P1) | C++98 | 1000 ms | 1908 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |