QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#764707 | #9248. An Easy Math Problem | 1903331632 | TL | 0ms | 3640kb | C++23 | 1.2kb | 2024-11-20 10:18:56 | 2024-11-20 10:18:56 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define all(s) s.begin(), s.end()
#define int long long
#define endl '\n'
const int N = 1e6 + 10;
const int mod = 1e9 + 7;
int q;
vector<int> is_p;
bool is[N];
void init()
{
for (int i = 2; i < N; i++)
{
if (is[i])
continue;
is_p.push_back(i);
for (int j = i + i; j < N; j += i)
{
is[j] = 1;
}
}
}
void solve()
{
int n;
cin >> n;
int t = n;
vector<int> v;
for (int i = 1; i <= sqrt(t) + 2; i++)
{
if (n % i == 0)
v.push_back(i);
}
v.push_back(n);
map<int, map<int, int>> mp;
for (int i = 0; i < v.size(); i++)
{
for (int j = 0; j <= i; j++)
{
int t1 = v[j];
int t2 = v[i];
int g = gcd(t1, t2);
if (n % (t1 * t2) == 0)
{
mp[t1 / g][t2 / g]++;
}
}
}
int res = 0;
for (auto t : mp)
{
res += t.second.size();
}
cout << res << endl;
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
cin >> t;
while (t--)
solve();
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3640kb
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
Time Limit Exceeded
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...