QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#692319 | #9248. An Easy Math Problem | KeeperHihi# | WA | 5ms | 5484kb | C++20 | 885b | 2024-10-31 14:19:06 | 2024-10-31 14:19:23 |
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-10-31 14:19:06]
- Submitted
answer
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
map<i64, int> Map;
void solve() {
i64 n;
cin >> n;
if (Map.count(n)) {
cout << Map[n] << "\n";
return;
}
vector<i64> p;
for (i64 i = 1; i * i <= n; i++) {
if (n % i == 0) {
p.emplace_back(i);
if (i * i != n) {
p.emplace_back(n / i);
}
}
}
sort(p.begin(), p.end());
int m = p.size();
unordered_set<long double> set;
for (int i = 0; i < m; i++) {
int t = lower_bound(p.begin(), p.end(), p[i] * p[i]) - p.begin();
for (int j = t; j < m; j++) {
if (p[j] % p[i] == 0) {
set.insert(1.L * p[i] * p[i] / p[j]);
}
}
}
cout << set.size() << "\n";
Map[n] = set.size();
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int t = 1;
cin >> t;
while (t--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3800kb
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: 5ms
memory: 5484kb
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:
29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 29527 ...
result:
wrong answer 1st lines differ - expected: '29525', found: '29527'