QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#779786 | #9248. An Easy Math Problem | XiaoYang3 | WA | 0ms | 3596kb | C++23 | 1.2kb | 2024-11-24 21:46:49 | 2024-11-24 21:46:49 |
Judging History
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;
map<int, int> mp;
void solve() {
cin >> n;
if (mp[n]) {
cout << mp[n] << '\n';
return;
}
vector<ll> v1;
// set<long double> se;
for (int i = 1; i <= n / i; i++) {
if (n % i == 0) {
v1.push_back(i);
v1.push_back(n / i);
}
}
//cout << v1.size() << ' ';
sort(v1.begin(), v1.end());
set<pii> se;
for (int i = 0; i < v1.size(); i++) {
for (int j = i + 1; j < v1.size(); j++) {
ll x = v1[i], y = v1[j];
if (y % x == 0) {
ll xx = x, yy = y / x;
if (xx < yy) {
swap(xx, yy);
}
ll d = __gcd(xx, yy);
se.insert({xx / d, yy / d});
}
}
}
mp[n] = se.size();
cout << se.size() << '\n';
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int _ = 1;
cin >> _;
while (_--) {
solve();
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3596kb
input:
10 1 2 3 4 5 6 7 8 9 10
output:
1 1 1 3 1 4 1 4 3 4
result:
wrong answer 2nd lines differ - expected: '2', found: '1'