結果

問題 No.3186 Big Order
コンテスト
ユーザー The Forsaking
提出日時 2025-06-20 23:31:53
言語 C++17
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 769 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,140 ms
コンパイル使用メモリ 218,008 KB
実行使用メモリ 9,420 KB
最終ジャッジ日時 2026-07-12 16:10:21
合計ジャッジ時間 7,149 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other WA * 25 TLE * 2 -- * 8
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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;
}
0