結果
| 問題 |
No.2818 A Game I Play to Pass the Time
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-07-19 23:58:50 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 648 bytes |
| コンパイル時間 | 568 ms |
| コンパイル使用メモリ | 68,096 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-19 23:59:29 |
| 合計ジャッジ時間 | 35,024 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 19 |
ソースコード
#include<iostream>
#include<cassert>
#include<atcoder/modint>
using namespace std;
using mint=atcoder::modint998244353;
mint H(long a,int b)
{
//H(a,b)=C(a+b-1,b)
mint x=1,y=1;
for(int i=1;i<=b;i++)x*=a+b-i,y*=i;
return x/y;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T;cin>>T;
for(;T--;)
{
long N,S;
cin>>N>>S;
mint ans=S;
for(int p=2;p<=100;p++)if(N%p==0)
{
int e=0;
while(N%p==0)N/=p,e++;
const mint invp=mint(p).inv();
mint now=0,pp=mint(p).pow(e);
for(int f=e;f>=0;f--)
{
now+=pp;
pp*=S-1+f-e;
pp/=e-f+1;
pp*=invp;
}
ans*=now;
}
cout<<ans.val()<<"\n";
}
}