結果
| 問題 |
No.2818 A Game I Play to Pass the Time
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-07-19 23:56:37 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 1,485 ms / 2,000 ms |
| コード長 | 577 bytes |
| コンパイル時間 | 639 ms |
| コンパイル使用メモリ | 67,456 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-19 23:57:10 |
| 合計ジャッジ時間 | 31,252 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 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++;
mint now=0,pp=1;
for(int f=0;f<=e;f++)
{
now+=H(S-1,e-f)*pp;
pp*=p;
}
ans*=now;
}
cout<<ans.val()<<"\n";
}
}