QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#654189 | #9242. An Easy Geometry Problem | 123BVN | WA | 3ms | 7408kb | C++23 | 1.9kb | 2024-10-18 21:13:12 | 2024-10-18 21:13:21 |
Judging History
answer
#include <bits/stdc++.h>
#pragma GCC optimize(3)
#define int long long
#define llu unsigned long long
#define endl "\n"
#define inf 0x3f3f3f3f
#define debug cout << "****************" << endl
#define bit(x) (1LL << x)
using namespace std;
typedef pair<int, int> PII;
const int N = 5e5 + 7;
vector<int> p3(100);
void solve()
{
int q;
cin >> q;
for (int i = 1; i <= q; i++)
{
vector<int> st1;
vector<int> mp(N);
int n;
cin >> n;
for (int j = 2; j * j <= n; j++)
{
while (n % j == 0)
{
n /= j;
if (!mp[j])
st1.push_back(j);
mp[j]++;
}
}
if (n > 1)
{
if (!mp[n])
st1.push_back(n);
mp[n]++;
}
int sum = 1;
for (auto x : st1)
{
int y = mp[x];
sum *= y + 1;
}
int ans = 0;
int cnt = st1.size();
for (int j = 1; j < bit(cnt); j++) // 6e4
{
int res = 1;
int res1 = 1;
int res2 = 1;
vector<int> st2(100);
int ok = 1;
int x = j;
int now = 0;
while (x)
{
st2[now] = x % 2;
x /= 2;
now++;
}
for (int k = 0; k < st1.size(); k++)
{
if (st2[k] == 0)
res1 *= (mp[st1[k]] + 1);
else
res2 *= mp[st1[k]];
}
res = (res1 - 1) * res2;
ans += res;
}
cout << ans / 2 + sum << endl;
}
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int T = 1;
int x = 1;
// cin >> T;
while (T--)
solve();
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 3ms
memory: 7408kb
input:
6 6 6 2 1 5 9 10 15 18 2 2 1 3 3 -3 2 2 1 3 4 3 2 3 2 4
output:
5 5 2 1 2 3
result:
wrong answer 1st numbers differ - expected: '1', found: '5'