UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#203492#2817. 小明的计算augury100213ms1212kbC++11755b2024-02-26 08:18:122024-02-26 14:00:06

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read(){
	int ans=0;bool op=0;char ch=getchar();
	while(ch<'0'||'9'<ch){if(ch=='-')op=1;ch=getchar();}
	while('0'<=ch&&ch<='9'){ans=(ans<<1)+(ans<<3)+(ch^48);ch=getchar();}
	if(op)return -ans;
	return ans;
}
const int mod=1e9+7;
int n,m;
vector<int>a;
int ans=1;
int ksm(int a,int b){
	int ans=1;
	for(;b;b>>=1,a=a*a%mod)if(b&1)ans=ans*a%mod;
	return ans;
}
int lst=1,tmp=1;
signed main(){
	n=read(),m=read();
	for(int i=2;i<=n;i++)while(n%i==0)a.push_back(i),n/=i;
	if(n>1)a.push_back(n);
	sort(a.begin(),a.end());
	for(int i:a){
		if(i!=lst){
			lst=i;
			tmp=1;
		}
		tmp=tmp*i;
		ans=ans*ksm(i,m/tmp)%mod;
	}
	cout<<ans<<'\n';
	return 0;
}

Details

小提示:点击横条可展开更详细的信息

Test #1:

score: 10
Accepted
time: 0ms
memory: 1212kb

input:

865987 941795


output:

852352201

result:

ok single line: '852352201'

Test #2:

score: 10
Accepted
time: 0ms
memory: 1208kb

input:

718079 336455


output:

866737698

result:

ok single line: '866737698'

Test #3:

score: 10
Accepted
time: 0ms
memory: 1208kb

input:

78100 231920


output:

148617020

result:

ok single line: '148617020'

Test #4:

score: 10
Accepted
time: 0ms
memory: 1208kb

input:

478780 349871


output:

627456355

result:

ok single line: '627456355'

Test #5:

score: 10
Accepted
time: 0ms
memory: 1208kb

input:

492436 177462


output:

710554997

result:

ok single line: '710554997'

Test #6:

score: 10
Accepted
time: 0ms
memory: 1212kb

input:

5498214 3423692


output:

754285740

result:

ok single line: '754285740'

Test #7:

score: 10
Accepted
time: 2ms
memory: 1208kb

input:

2257405 2442817


output:

509022777

result:

ok single line: '509022777'

Test #8:

score: 10
Accepted
time: 0ms
memory: 1212kb

input:

525133 3839557


output:

712423552

result:

ok single line: '712423552'

Test #9:

score: 10
Accepted
time: 4ms
memory: 1212kb

input:

559167069 414841373


output:

191742478

result:

ok single line: '191742478'

Test #10:

score: 10
Accepted
time: 207ms
memory: 1208kb

input:

64401879 171289385


output:

75367261

result:

ok single line: '75367261'