ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#203498 | #2817. 小明的计算 | Binaries | 100 | 0ms | 1124kb | C++11 | 1.9kb | 2024-02-26 09:25:17 | 2024-02-26 14:00:26 |
answer
//吾日十三省吾身:
//输入多而不快读乎?
//题目标注而不freopen乎?
//乘除并列先乘后除乎?
//不手撕样例直接写代码乎?
//不仔细读题直接关页面乎?
//1e9而不开long long乎?
//Ctrl+V而不改名称乎?(papaw->papan IMPLIES tg1=->2=)
//相信评测神机乎?
//多测清空而不彻底乎?
//写完题而不对拍乎?
//只考虑期望复杂度而不记忆化乎?
//区间统计问题而不考虑差分trick乎?
//满足可行性单调的最优性问题而不二分答案乎?
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<iomanip>
#include<cctype>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<algorithm>
#include<utility>
#include<deque>
#include<ctime>
#include<sstream>
#include<list>
#include<bitset>
using namespace std;
typedef long long ll;
namespace FastIO{
template<class T> void R(T &x){
x=0;ll f=1;char c='c';
while(c>'9' or c<'0'){f=(c=='-'?-f:f);c=getchar();}
while(c<='9' and c>='0'){x=(x<<3)+(x<<1)+c-'0';c=getchar();}
x*=f;
return;
}
template<class T,class... _T> void R(T& x,_T&... _x){R(x);R(_x...);return;}
template<class T> void W(T x,char c=0){
if(c){W(x);putchar(c);}
else if(x<0){putchar('-');W(-x);}
else if(x<10){putchar(x+'0');}
else{W(x/10);putchar(x%10+'0');}
return;
}
}
using namespace FastIO;
const ll MO(1e9+7);
ll fpow(ll x,ll y){
ll res=1;
while(y){
if(y&1) res=(res*x)%MO;
x=(x*x)%MO;
y>>=1;
}
return res;
}
ll n,m;
ll ans=1;
int main(){
R(n,m);
for(ll i=2;i*i<=n;++i){
ll tot=0,ipow=i;
while(n%i==0){
++tot;n/=i;
ll cnt=m/ipow-((n%i==0)?m/(ipow*i):0);
if(!cnt) break;
ans=(ans*fpow(ipow%MO,cnt))%MO;
ipow*=i;
}
}
if(n>1) ans=(ans*fpow(n%MO,m/n))%MO;
W(ans,'\n');
return 0;
}
Details
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 1124kb
input:
865987 941795
output:
852352201
result:
ok single line: '852352201'
Test #2:
score: 10
Accepted
time: 0ms
memory: 1124kb
input:
718079 336455
output:
866737698
result:
ok single line: '866737698'
Test #3:
score: 10
Accepted
time: 0ms
memory: 1120kb
input:
78100 231920
output:
148617020
result:
ok single line: '148617020'
Test #4:
score: 10
Accepted
time: 0ms
memory: 1120kb
input:
478780 349871
output:
627456355
result:
ok single line: '627456355'
Test #5:
score: 10
Accepted
time: 0ms
memory: 1124kb
input:
492436 177462
output:
710554997
result:
ok single line: '710554997'
Test #6:
score: 10
Accepted
time: 0ms
memory: 1124kb
input:
5498214 3423692
output:
754285740
result:
ok single line: '754285740'
Test #7:
score: 10
Accepted
time: 0ms
memory: 1120kb
input:
2257405 2442817
output:
509022777
result:
ok single line: '509022777'
Test #8:
score: 10
Accepted
time: 0ms
memory: 1124kb
input:
525133 3839557
output:
712423552
result:
ok single line: '712423552'
Test #9:
score: 10
Accepted
time: 0ms
memory: 1120kb
input:
559167069 414841373
output:
191742478
result:
ok single line: '191742478'
Test #10:
score: 10
Accepted
time: 0ms
memory: 1120kb
input:
64401879 171289385
output:
75367261
result:
ok single line: '75367261'