# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
19554 |
2016-02-24T18:10:52 Z |
inspire12 |
Α (kriii4_P1) |
C++ |
|
0 ms |
1208 KB |
#include <cstdio>
#include <vector>
using namespace std;
vector<pair<long long, long long> > v;
unsigned long long res = 1;
int main() {
long long n;
long long m;
long long i;
unsigned long long temp;
pair<long long, long long> p;
long long num = 0;
scanf("%lld", &n);
scanf("%lld", &m);
p.first = n;
p.second = 1;
v.push_back(p);
temp = n;
for (i = 2; i <= m; i *= 2) {
p.first = (temp * temp) % 1000000007;
temp = ( temp * temp )% 1000000007;
p.second = i;
v.push_back(p);
} long long a;
while(!v.empty() && m>0){
a = v[v.size() - 1].second;
if(m- a>=0) res = ((res % 1000000007) * (v[v.size()-1].first % 1000000007)), m-= a;
v.pop_back();
} printf("%lld", res % 1000000007);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1208 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |