結果
| 問題 |
No.2896 Monotonic Prime Factors
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2024-09-25 15:21:01 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 169 ms / 2,000 ms |
| コード長 | 937 bytes |
| コンパイル時間 | 3,299 ms |
| コンパイル使用メモリ | 246,668 KB |
| 実行使用メモリ | 26,972 KB |
| 最終ジャッジ日時 | 2024-09-25 15:21:08 |
| 合計ジャッジ時間 | 6,236 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
ソースコード
#include <bits/stdc++.h>
#define _1 (__int128)1
using namespace std;
using ll = long long;
void FileIO (const string s) {
freopen(string(s + ".in").c_str(), "r", stdin);
freopen(string(s + ".out").c_str(), "w", stdout);
}
const int N = 2e6 + 10, mod = 998244353;
int n, inv[N], x[N], f[N], a, b, ans;
bool ip[N];
inline int C (int a, int b) {
if (a < b) return 0;
return 1ll * f[a] * x[b] % mod * x[a - b] % mod;
}
signed main () {
ios::sync_with_stdio(0), cin.tie(0);
// FileIO("");
inv[1] = x[0] = f[0] = 1;
for (int i = 2; i <= 2e6; i++)
inv[i] = 1ll * (mod - mod / i) * inv[mod % i] % mod;
for (int i = 1; i <= 2e6; i++)
x[i] = 1ll * x[i - 1] * inv[i] % mod, f[i] = 1ll * f[i - 1] * i % mod;
for (cin >> n; n--; ) {
cin >> a >> b;
for (int i = 2; i * i <= a; i++)
while (a % i == 0)
a /= i, ans++;
if (a > 1) ans++;
cout << C(ans - 1, b - 1) << '\n';
}
return 0;
}
vjudge1