Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- const int man=1000005;
- const int MAXM= 15000005;
- ll mod = 1e9+7;
- ll fac[man];
- ll n,m;
- void init()
- {
- fac[0]=1;
- for(ll i=1;i<man;i++)
- fac[i]=(fac[i-1]*i)%mod;
- }
- ll quickpow(ll a,ll b,ll p)
- {
- ll ans=1%p;
- while(b)
- {
- if(b&1) ans=ans*a%p;
- a=a*a%p;
- b>>=1;
- }
- return ans;
- }
- ll inv(ll a,ll mod)
- {
- return quickpow(a,mod-2,mod);
- }
- ll Cal(ll n,ll m,ll mod)
- {
- ll a=fac[n];
- ll b=(fac[m]*fac[n-m])%mod;
- return (a*inv(b,mod))%mod;
- }
- map<ll,ll> prime_dection(ll x)
- {
- map<ll,ll> res;
- for(ll i=2;i*i<=x;i++)
- {
- while(x%i==0)
- {
- ++res[i];
- x/=i;
- }
- }
- if(x!=1) res[x]++;
- return res;
- }
- int main()
- {
- ios::sync_with_stdio(false);
- cin.tie(0);
- cout.tie(0);
- cin>>n>>m;
- init();
- auto ss=prime_dection(m);
- ll ans=1;
- for(auto &t: ss)
- {
- ll num = t.second;
- ll tmp=Cal(n+num-1,num,mod);
- ans=(ans*tmp)%mod;
- }
- cout<<ans<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement