ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#203490 | #2817. 小明的计算 | hegm | 100 | 0ms | 1168kb | C++11 | 870b | 2024-02-26 08:02:30 | 2024-02-26 13:59:59 |
answer
#include<bits/stdc++.h>
#define fi first
#define se second
#define ull unsigned long long
#define make make_pair
#define N 1000000
#define int long long
#define mod 1000000007
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;
}
int n,m,p[N],num[N],tot;
int ksm(int d,int z)
{
int ans=1;
while(z)
{
if(z&1)ans=(ans*d)%mod;
d=(d*d)%mod;z>>=1;
}
return ans;
}
signed main()
{
n=read();m=read();
for(int i=2;i*i<=n;i++)
{
if(n%i==0)p[++tot]=i;
while(n%i==0)num[tot]++,n/=i;
}
if(n>1)p[++tot]=n,num[tot]=1;
int ans=1;
for(int i=1,c;i<=tot;i++)
{
c=1;
for(int j=1;j<=num[i];j++)
{
c*=p[i];
ans=(ans*ksm(p[i],m/c))%mod;
}
}
cout<<ans<<"\n";
return 0;
}
Details
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 1168kb
input:
865987 941795
output:
852352201
result:
ok single line: '852352201'
Test #2:
score: 10
Accepted
time: 0ms
memory: 1168kb
input:
718079 336455
output:
866737698
result:
ok single line: '866737698'
Test #3:
score: 10
Accepted
time: 0ms
memory: 1164kb
input:
78100 231920
output:
148617020
result:
ok single line: '148617020'
Test #4:
score: 10
Accepted
time: 0ms
memory: 1168kb
input:
478780 349871
output:
627456355
result:
ok single line: '627456355'
Test #5:
score: 10
Accepted
time: 0ms
memory: 1168kb
input:
492436 177462
output:
710554997
result:
ok single line: '710554997'
Test #6:
score: 10
Accepted
time: 0ms
memory: 1168kb
input:
5498214 3423692
output:
754285740
result:
ok single line: '754285740'
Test #7:
score: 10
Accepted
time: 0ms
memory: 1168kb
input:
2257405 2442817
output:
509022777
result:
ok single line: '509022777'
Test #8:
score: 10
Accepted
time: 0ms
memory: 1168kb
input:
525133 3839557
output:
712423552
result:
ok single line: '712423552'
Test #9:
score: 10
Accepted
time: 0ms
memory: 1168kb
input:
559167069 414841373
output:
191742478
result:
ok single line: '191742478'
Test #10:
score: 10
Accepted
time: 0ms
memory: 1168kb
input:
64401879 171289385
output:
75367261
result:
ok single line: '75367261'