# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
19595 | panda959595 | Α (kriii4_P1) | C++98 | 0 ms | 1716 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];
long long A[100];
a %= 1000000007;
A[0] = a;
for (int i = 0; i < 100; i++)
{
if (i > 0)
{
A[i] = A[i - 1] * A[i - 1];
A[i] %= 1000000007;
}
num[i] = false;
if (b == 0)
{
k = i;
break;
}
if (b % 2 == 1)
num[i] = true;
b /= 2;
}
long long answer = 1;
int p;
for (int i = 0; i < k; i++)
{
if (num[i])
{
answer *= A[i];
answer %= 1000000007;
}
}
cout << answer << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |