QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#779719#9248. An Easy Math ProblemXiaoYang3TL 1ms3784kbC++23967b2024-11-24 21:23:172024-11-24 21:23:18

Judging History

This is the latest submission verdict.

  • [2024-11-24 21:23:18]
  • Judged
  • Verdict: TL
  • Time: 1ms
  • Memory: 3784kb
  • [2024-11-24 21:23:17]
  • Submitted

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;
vector<int> fac[N];

void solve() {
    cin >> n;
    vector<ll> v1;
    vector<ll> v2;
    // set<long double> se;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            v1.push_back(i);
            v1.push_back(n / i);
        }
    }
    set<pii> se;
    for (auto x : v1) {
        for (auto y : v1) {
            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});
            }
        }
    }
    cout << se.size() << '\n';
}
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    int _ = 1;
    cin >> _;
    while (_--) {
        solve();
    }
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3784kb

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...

output:


result: