QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#747469#9248. An Easy Math ProblemYehhhhWA 361ms3792kbC++17906b2024-11-14 17:15:202024-11-14 17:15:20

Judging History

This is the latest submission verdict.

  • [2024-11-14 17:15:20]
  • Judged
  • Verdict: WA
  • Time: 361ms
  • Memory: 3792kb
  • [2024-11-14 17:15:20]
  • Submitted

answer

#include <bits/stdc++.h>

using namespace std;

vector<int> prime;

void Init() {
    for (int i = 2; i <= 1e6; i++) {
        bool flag = true;
        for (int j = 2; j * j <= i && flag; j++) {
            if (i % j == 0) {
                flag = false;
            }
        }
        if (flag) {
            prime.push_back(i);
        }
    }
}

void solve() {
    long long n;
    cin >> n;
    long long ans = 1;
    for (auto x : prime) {
        if (x > n) {
            break;
        }
        int num = 0;
        while (n % x == 0) {
            n /= x;
            num++;
        }
        if (num) {
            ans *= (2 * num + 1);
        }
    }
    cout << ans / 2 + 1 << "\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    Init();
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 121ms
memory: 3724kb

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: 0
Accepted
time: 121ms
memory: 3788kb

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:

29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
...

result:

ok 2000 lines

Test #3:

score: -100
Wrong Answer
time: 361ms
memory: 3792kb

input:

2000
1763047095
79735483
1016286871
2864801397
2327774116
2668010360
3469893354
3634459021
1613699068
781737219
574741575
2763134701
1458502604
1822260248
2281150332
2924219311
2493931196
3735904708
158802001
2006921221
729928782
1974841034
727412600
2873393292
1291087179
2741607663
1893408215
29827...

output:

5
5
1
2
23
95
23
14
3
68
203
14
8
32
13
41
3
3
14
1
608
41
158
338
23
41
5
2
14
41
5
203
41
14
6
446
2
18
59
878
1
14
365
203
5
203
1
122
32
95
41
41
2
23
5
14
2
2
14
122
8
203
608
8
41
122
1
5
32
1
68
41
203
5
230
41
23
8
17
5
11
14
3
2
2
2
68
68
41
293
473
2
14
41
14
1
5
5
2
1
122
41
11
23
5
1
14
...

result:

wrong answer 1st lines differ - expected: '14', found: '5'