General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
61488014 Contestant:
amitgomi
1228C - 31 GNU C++14 Wrong answer on pretest 3 30 ms 4 KB 2019-09-29 16:42:59 2019-09-29 16:43:04
 
 
→ Source
//amitgomi
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(),x.end()
#define mp(x,y) make_pair(x,y)
#define mod 1000000007
#define sc(x) scanf("%d", &x)
#define sl(x) scanf("%lld", &x)

///////////////////////////////////////////////////////////
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
// ordered_set st;
// st.order_of_key(l);
// double PI=3.1415926535897932384626;
ll bin_expo(ll a,ll b, ll m){ ll res =1; a %= m; while(b!=0){ if(b%2==1) res = (res*a)%mod; a = (a*a)%mod; b = b/2; } return res; }
// ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); } 
///////////////////////////////////////////////////////////////////////////////////////////////////


int main(){
	// ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

	ll x,n;
	cin>>x>>n;
	vector <ll> v;
	ll a = x;
	for(int i=2;i<=sqrt(a);i++){
		if(a%i==0){
			v.push_back(i);
		}
		while(a%i==0)
			a=a/i;
	}
	if(a!=1)
		v.push_back(a);

	ll ans=1;
	for(int i=0;i<v.size();i++){
		ll a=1;
		while(1){
			ll aa = a;
			a = a*v[i];
			if(a/aa!=v[i])
				break;
			// cout<<a<<endl;
			if(n/a==0)
				break;
			ans = (ans*bin_expo(v[i],n/a,mod))%mod;
			x = x/v[i];
		}
	}
	cout<<ans<<endl;
	return 0;
}
 
 
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details