結果
| 問題 |
No.2818 A Game I Play to Pass the Time
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-10-16 20:33:30 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 942 bytes |
| コンパイル時間 | 1,792 ms |
| コンパイル使用メモリ | 162,288 KB |
| 実行使用メモリ | 15,944 KB |
| 最終ジャッジ日時 | 2025-10-16 20:33:37 |
| 合計ジャッジ時間 | 6,926 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | TLE * 1 -- * 18 |
ソースコード
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int mod=998244353;
const int N=1e6+10;
int n,p[N],k[N],m,s;
int Pow(int a,int b=mod-2){
int s=1;
while(b){
if(b&1)s=s*a%mod;
a=a*a%mod;b>>=1;
}
return s;
}
int C[N];
void solve(){
cin>>n>>s;m=0;
int x=n;
for(int i=2;i*i<=x;++i)if(x%i==0){
p[++m]=i;while(x%i==0)++k[m],x/=i;
}
if(x!=1)p[++m]=x,k[m]=1;
int ans=1;
C[0]=1;
for(int i=0;i<100;++i)C[i+1]=C[i]*(s-2+i+1)%mod*Pow(i+1)%mod;
for(int i=1;i<=m;++i){
int val=0;
for(int j=0;j<=k[i];++j){
val=(val+Pow(p[i],k[i]-j)%mod*C[j]%mod)%mod;
}
ans=ans*val%mod;
}
ans=ans*(s%mod)%mod;
cout<<ans<<'\n';
return ;
}//????
signed main(){
ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int T;cin>>T;while(T--)solve();
return 0;
}
/*
1
897612484786617600 1000000000000000000
*/
vjudge1