QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#762772 | #9248. An Easy Math Problem | mobbb | WA | 57ms | 3868kb | C++20 | 985b | 2024-11-19 16:35:15 | 2024-11-19 16:35:20 |
Judging History
answer
#include <bits/stdc++.h>
#define ll long long
std::vector<int> minp, primes;
void sieve(int n) {
minp.assign(n + 1, 0);
primes.clear();
for (int i = 2; i <= n; i++) {
if (minp[i] == 0) {
minp[i] = i;
primes.push_back(i);
}
for (auto p : primes) {
if (i * p > n) {
break;
}
minp[i * p] = p;
if (p == minp[i]) {
break;
}
}
}
}
bool is_prime(int x){
return (minp[x] == x);
}
void solve(){
ll n;
std::cin >> n;
ll cnt = 1;
for (auto y : primes) if (n % y == 0){
ll tmp = 0;
while (n % y == 0){
tmp ++;
n /= y;
}
cnt *= (tmp * 2 + 1);
}
std::cout << (cnt + 1) / 2 << '\n';
}
int main(){
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
sieve(1E5);
int q;
std::cin >> q;
while (q--){
solve();
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3812kb
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: 56ms
memory: 3868kb
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: 3868kb
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'