結果
| 問題 | No.2896 Monotonic Prime Factors |
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2024-09-27 00:39:11 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 86 ms / 2,000 ms |
| コード長 | 1,227 bytes |
| コンパイル時間 | 6,250 ms |
| コンパイル使用メモリ | 274,884 KB |
| 実行使用メモリ | 11,832 KB |
| 最終ジャッジ日時 | 2024-09-27 00:39:21 |
| 合計ジャッジ時間 | 7,195 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
ソースコード
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define i64 long long
const int M=2e6+10;
const int N=1e5+10;
const int mod=998244353;
int cnt[N];
int fac[M];
int factor(int x){
if(cnt[x]!=0) return cnt[x];
int res=0;
int t=x;
for(int i=2;1ll*i*i<=x;i++){
if(x%i==0){
while(x%i==0){
x/=i;
res++;
}
}
}
if(x!=1) res++;
//cout<<t<<" "<<res<<endl;
return cnt[t]=res;
}
int qpow(int a,int b){
int res=1;
while(b){
if(b&1) res=1ll*res*a%mod;
a=1ll*a*a%mod;
b>>=1;
}
return res;
}
int C(int m ,int n){
if(m>n) return 0;
return 1ll*fac[n]*qpow(fac[n-m],mod-2)%mod*qpow(fac[m],mod-2)%mod;
}
void init(){
fac[1]=fac[0]=1;
for(int i=2;i<M;i++){
fac[i]=1ll*fac[i-1]*i%mod;
}
}
int x=1;
i64 n=0;
void solved(){
int a,b;
cin>>a>>b;
//x=1ll*x*a%mod;
//cout<<x<<endl;
n=(n+factor(a))%mod;
//cout<<b<<" "<<n<<endl;
cout<<C(b-1,n-1)<<endl;
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t=1;
cin>>t;
init();
while(t--) solved();
}
vjudge1