結果
問題 |
No.3186 Big Order
|
ユーザー |
|
提出日時 | 2025-06-20 23:31:53 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 769 bytes |
コンパイル時間 | 1,764 ms |
コンパイル使用メモリ | 202,876 KB |
実行使用メモリ | 11,172 KB |
最終ジャッジ日時 | 2025-06-20 23:32:04 |
合計ジャッジ時間 | 10,171 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | WA * 24 TLE * 1 -- * 9 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:35:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 35 | scanf("%lld%lld%lld", &a, &b, &c); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; typedef long long ll; const int N = 2000008, MOD = 998244353, INF = 0x3f3f3f3f; ll res; int n, m, cnt, w[N]; ll a, b, c; void solve() { map<ll, ll> ma, mb; for (ll i = 2; i * i <= a; i++) { while (a % i == 0) ma[i] += b, a /= i; } if (a != 1) ma[a] += b; for (ll i = 2; i * i <= c; i++) { while (c % i == 0) mb[i]++, c /= i; } if (c != 1) mb[c]++; res = 1e18; for (auto [x, y] : mb) { if (!ma.count(x)) res = 0; else res = min(res, ma[x] / y); } printf("%lld\n", res % MOD); } int main() { int T; cin >> T; while (T--) { scanf("%lld%lld%lld", &a, &b, &c); solve(); } return 0; }