ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#203488 | #2817. 小明的计算 | yizhiming | 100 | 0ms | 1160kb | C++11 | 858b | 2024-02-26 07:58:12 | 2024-02-26 13:59:53 |
answer
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <queue>
#define int long long
using namespace std;
int read(){
int x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
const int Mod = 1e9+7;
int n,m,ans = 1;
int ksm(int x,int y){
int res = 1;
while(y){
if(y&1){
res = res*x%Mod;
}
y>>=1;
x = x*x%Mod;
}
return res;
}
signed main(){
n = read();m = read();
for(int i=2;i*i<=n;i++){
int cnt = 0;
while(n%i==0){
cnt++;
n/=i;
}
if(cnt){
int res = 0;int x = m;
for(int j=1;j<=cnt;j++){
x/=i;
res+=x;
}
ans = ans*ksm(i,res)%Mod;
}
}
if(n!=1){
ans = ans*ksm(n,m/n)%Mod;
}
cout<<ans<<"\n";
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 1160kb
input:
865987 941795
output:
852352201
result:
ok single line: '852352201'
Test #2:
score: 10
Accepted
time: 0ms
memory: 1156kb
input:
718079 336455
output:
866737698
result:
ok single line: '866737698'
Test #3:
score: 10
Accepted
time: 0ms
memory: 1156kb
input:
78100 231920
output:
148617020
result:
ok single line: '148617020'
Test #4:
score: 10
Accepted
time: 0ms
memory: 1160kb
input:
478780 349871
output:
627456355
result:
ok single line: '627456355'
Test #5:
score: 10
Accepted
time: 0ms
memory: 1156kb
input:
492436 177462
output:
710554997
result:
ok single line: '710554997'
Test #6:
score: 10
Accepted
time: 0ms
memory: 1160kb
input:
5498214 3423692
output:
754285740
result:
ok single line: '754285740'
Test #7:
score: 10
Accepted
time: 0ms
memory: 1160kb
input:
2257405 2442817
output:
509022777
result:
ok single line: '509022777'
Test #8:
score: 10
Accepted
time: 0ms
memory: 1156kb
input:
525133 3839557
output:
712423552
result:
ok single line: '712423552'
Test #9:
score: 10
Accepted
time: 0ms
memory: 1160kb
input:
559167069 414841373
output:
191742478
result:
ok single line: '191742478'
Test #10:
score: 10
Accepted
time: 0ms
memory: 1160kb
input:
64401879 171289385
output:
75367261
result:
ok single line: '75367261'