Submission #19405

# Submission time Handle Problem Language Result Execution time Memory
19405 2016-02-24T11:22:47 Z inspire12 Α (kriii4_P1) C++
0 / 100
1000 ms 1080 KB
#include <cstdio>
int main() {
	long long n;
	long long m;
	long long i;
	long long x = 0;
	scanf("%lld", &n);
	scanf("%lld", &m);
	for (i = 1000000000000000000; i >= 1; i /= 2) {
		if (m - i > 0) m -= i, x += i;
		if (m - i == 0) {
			x += i;
			break;
		}
	}
	unsigned long long res = 1;
	for (i = 1; i <= x; i++) {
		res = (res *  n) % 1000000007;
	} printf("%lld", res % 1000000007);
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1000 ms 1080 KB Program timed out
2 Halted 0 ms 0 KB -