結果
| 問題 |
No.2818 A Game I Play to Pass the Time
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-08-18 15:10:56 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 524 ms / 2,000 ms |
| コード長 | 775 bytes |
| コンパイル時間 | 2,055 ms |
| コンパイル使用メモリ | 168,296 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-08-18 15:11:13 |
| 合計ジャッジ時間 | 15,327 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
using LL = long long;
const int N = 67;
const int MOD = 998244353;
int inv[N];
void solve() {
LL n, s;
scanf("%lld%lld", &n, &s);
int ans = s % MOD;
for(int i = 2; i <= 100; ++i)
if(n % i == 0) {
LL mul = 1;
int tmp = 0, cnt = 0;
while(n % i == 0) {
++cnt;
n /= i;
mul *= i;
}
for(int j = 0, c = 1; j <= cnt; ++j) {
tmp = (tmp + mul % MOD * c) % MOD;
c = 1LL * c * ((s + j - 1) % MOD) % MOD * inv[j + 1] % MOD;
mul /= i;
}
ans = 1LL * ans * tmp % MOD;
}
printf("%d\n", ans);
}
int main() {
inv[1] = 1;
for(int i = 2; i < N; ++i)
inv[i] = MOD - 1LL * MOD / i * inv[MOD % i] % MOD;
int cases = 1;
scanf("%d", &cases);
while(cases--)
solve();
return 0;
}