結果
問題 |
No.2818 A Game I Play to Pass the Time
|
ユーザー |
|
提出日時 | 2024-08-18 15:03:59 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 769 bytes |
コンパイル時間 | 2,004 ms |
コンパイル使用メモリ | 193,120 KB |
最終ジャッジ日時 | 2025-02-23 23:07:19 |
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | WA * 19 |
コンパイルメッセージ
main.cpp: In function ‘void solve()’: main.cpp:12:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | scanf("%lld%lld", &n, &s); | ~~~~~^~~~~~~~~~~~~~~~~~~~ main.cpp: In function ‘int main()’: main.cpp:40:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 40 | scanf("%d", &cases); | ~~~~~^~~~~~~~~~~~~~
ソースコード
#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 * 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; }