# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
19521 |
2016-02-24T15:20:02 Z |
panda959595 |
Α (kriii4_P1) |
C++ |
|
1000 ms |
1908 KB |
#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 |
1 |
Execution timed out |
1000 ms |
1908 KB |
Program timed out |
2 |
Halted |
0 ms |
0 KB |
- |