ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#203491 | #2817. 小明的计算 | UperFicial | 100 | 1ms | 1160kb | C++11 | 1.4kb | 2024-02-26 08:04:00 | 2024-02-26 14:00:02 |
answer
#include<bits/stdc++.h>
#define int long long
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(b);i>=(a);i--)
#define endl "\n"
#define For(i,u) for(int i=head[u];i;i=e[i].next)
#define V vector<int>
#define VV vector<V>
#define Debug(a) cout<<"QwQ "<<a<<endl;
#define FST NOT_FST
#define trash_round unrated
#define pint pair<int,int>
#define fi first
#define se second
#define Vp vector<pint>
const int MOD=1e9+7;
using namespace std;
int n,m;
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;
}
string reads()
{
char ch=getchar();string s;
while(ch<'a'||ch>'z'){ch=getchar();}
while(ch>='a'&&ch<='z'){s+=ch;ch=getchar();}
return s;
}
char readc()
{
char ch=getchar();
while(ch<'a'||ch>'z') ch=getchar();
return ch;
}
// down is mytrue code ------------------------------
int ksm(int a,int b)
{
int ans=1;
while(b)
{
if(b&1) ans=ans*a%MOD;
b/=2;
a=a*a%MOD;
}
return ans;
}
signed main()
{
int n=read(),m=read();
int x=n,ans=1;
for(int i=2;i*i<=n;i++)
{
int z=i;
while(x%i==0)
{
int k=m/z;
x/=i;
ans=ans*ksm(i,k)%MOD;
z=z*i;
}
}
int z=x;
if(x)
{
int k=m/z;
ans=ans*ksm(x,k)%MOD;
}
cout<<ans<<endl;
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 1156kb
input:
865987 941795
output:
852352201
result:
ok single line: '852352201'
Test #2:
score: 10
Accepted
time: 0ms
memory: 1160kb
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: 1160kb
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: 1ms
memory: 1160kb
input:
2257405 2442817
output:
509022777
result:
ok single line: '509022777'
Test #8:
score: 10
Accepted
time: 0ms
memory: 1160kb
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: 1156kb
input:
64401879 171289385
output:
75367261
result:
ok single line: '75367261'