QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#552494#9248. An Easy Math Problemucup-team180#WA 57ms3956kbC++201.6kb2024-09-07 23:14:422024-09-07 23:14:43

Judging History

This is the latest submission verdict.

  • [2024-10-31 22:36:43]
  • hack成功,自动添加数据
  • (/hack/1098)
  • [2024-10-31 22:13:58]
  • hack成功,自动添加数据
  • (/hack/1096)
  • [2024-10-31 22:00:43]
  • hack成功,自动添加数据
  • (/hack/1095)
  • [2024-09-07 23:14:43]
  • Judged
  • Verdict: WA
  • Time: 57ms
  • Memory: 3956kb
  • [2024-09-07 23:14:42]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define ov3(a, b, c, name, ...) name
#define rep0(n) for(ll aaaaa = 0; aaaaa < (n); aaaaa++)
#define rep1(i, n) for(ll i = 0; i < (n); i++)
#define rep2(i, a, b) for(ll i = (a); i < (b); i++)
#define rep(...) ov3(__VA_ARGS__, rep2, rep1, rep0)(__VA_ARGS__)
#define per(i, a, b) for(ll i = (a) - 1; i >= b; i--)
#define fore(e, v) for(auto &&e : v)
#define all(a) begin(a), end(a)
#define si(a) (int)(size(a))
#define lb(v, x) (lower_bound(all(v), x) - begin(v))
#define eb emplace_back
template <typename T, typename S> bool chmin(T &a, S &b) { return a > b ? a = b, true : false; }
template <typename T, typename S> bool chmax(T &a, S &b) { return a < b ? a = b, true : false; }

const int INF = 1e9 + 100;
const ll INFL = 3e18 + 100;

#define i128 __int128_t

struct _ {
    _() { cin.tie(0)->sync_with_stdio(0), cout.tie(0); }
} __;

int main() {
    int q;
    cin >> q;

    constexpr int M = 1e5 + 100;
    vi table(M, 1);
    table[0] = table[1] = false;
    rep(i, 2, M) {
        if(table[i]) {
            for(int j = i * 2; j < M; j += i) table[j] = 0;
        }
    }
    vi p;
    rep(i, 2, M) if(table[i]) p.eb(i);

    rep(q) {
        ll n;
        cin >> n;
        ll ans = 1;
        fore(x, p) {
            int c = 0;
            while(n % x == 0) n /= x, c++;
            if(c) { ans *= 1 + c * 2; }
        }
        cout << (ans + 1) / 2 << '\n';
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3956kb

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: 57ms
memory: 3820kb

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: 57ms
memory: 3880kb

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
8
95
23
14
3
68
203
5
8
11
13
41
3
3
14
1
608
41
158
113
8
41
5
2
5
41
5
203
41
5
6
446
2
18
20
878
1
5
365
203
5
68
1
122
32
32
41
14
2
23
5
14
2
2
5
122
8
203
608
8
41
122
1
5
32
1
68
41
68
5
230
14
23
8
17
5
11
14
3
2
2
2
23
68
41
293
473
2
14
41
14
1
5
5
2
1
122
41
11
23
5
1
14
2
14
14
8...

result:

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