Submission #19516

# Submission time Handle Problem Language Result Execution time Memory
19516 2016-02-24T15:03:49 Z panda959595 Α (kriii4_P1) C++
0 / 100
1000 ms 1712 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;
	long long k;
	cin >> a >> b;
	int num;
	a %= 1000000007;
	while (1)
	{
		num = a;
		if (b == 1)
			break;
		for (int i = b; i >= 1; i--)
		{
			if (b%i == 0)
			{
				k = i;
				break;
			}
		}
		b /= k;
		for (int i = 1; i < k; i++)
		{
			a = a*num;
			a %= 1000000007;
		}
	}
	cout << a << endl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1000 ms 1712 KB Program timed out
2 Halted 0 ms 0 KB -