QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#785036#9248. An Easy Math ProblemXiaoYang3WA 24ms3816kbC++231.5kb2024-11-26 16:40:462024-11-26 16:40:47

Judging History

This is the latest submission verdict.

  • [2024-11-26 16:40:47]
  • Judged
  • Verdict: WA
  • Time: 24ms
  • Memory: 3816kb
  • [2024-11-26 16:40:46]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 2e5 + 5;
using pii = pair<ll, ll>;
ll n, m, k;
const ll P = 998244353;
ll qp(ll a, ll b) {
    ll res = 1;
    while (b) {
        if (b & 1) {
            res = res * a;
        }
        b >>= 1;
        a = a * a;
    }
    return res;
}
void solve() {
    cin >> n;
    map<ll, int> mp;
    for (int i = 2; i <= n / i; i++) {
        if (n < i) {
            break;
        }
        if (n % i == 0) {
            while (n % i == 0) {
                mp[i]++;
                n /= i;
            }
        }
    }
    if (n != 1) {
        mp[n]++;
    }

    int ans = 0;
    n = mp.size();
    vector<int> a;
    for (auto [x, y] : mp) {
        a.push_back(y);
    }
    for (int now = 0; now < n; now++) {
        int sum = a[now];
        int fg = 0;
        for (int i = 0; i < (1 << n); i++) {
            if (i >> now & 1) {
                break;
            }
            for (int j = 0; j < n; j++) {
                if (i >> j & 1) {
                    sum *= a[j];
                    fg = 1;
                }
            }
        }
        if (fg)
            ans += sum;
    }
    // cout << ans;
    ans = (ans + 1) / 2;
    int res = 1;
    for (auto [x, y] : mp) {
        res *= (y + 1);
    }
    ans += res;
    cout << ans << '\n';
}
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    int _ = 1;
    cin >> _;
    while (_--) {
        solve();
    }
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3588kb

input:

10
1
2
3
4
5
6
7
8
9
10

output:

1
2
2
3
2
5
2
4
3
5

result:

ok 10 lines

Test #2:

score: -100
Wrong Answer
time: 24ms
memory: 3816kb

input:

2000
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
646969323...

output:

1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
...

result:

wrong answer 1st lines differ - expected: '29525', found: '1029'