# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
19521 | panda959595 | Α (kriii4_P1) | C++98 | 1000 ms | 1908 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |