/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 60ms 8.188 MiB
#2 Accepted 88ms 8.941 MiB
#3 Accepted 76ms 8.938 MiB
#4 Accepted 85ms 8.77 MiB
#5 Accepted 78ms 9.02 MiB

Code

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define int long long
#define all(x) (x).begin(), (x).end()
#define f(i, n) for (int i = 0; i < n; i++)
#define trace(x) cerr << #x << ": " << x << '\n'
int gcd(int a, int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
int div(int n)
{
    int ans = 0;
    for (int i = 1; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            ans++;
            if (i * i != n)
                ans++;
        }
    }
    return ans;
}
const int N = 1e6 + 5;
int di[N];
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    for (int i = 1; i < N; i++)
    {
        for (int j = i; j < N; j += i)
        {
            di[j]++;
        }
    }
    for (int i = 1; i < N; i++)
        di[i]--;
    for (int i = 1; i < N; i++)
        di[i] += di[i - 1];
    int t;
    cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        cout << di[n] << "\n";
    }
}

Information

Submit By
Type
Submission
Problem
P1206 D1. GCD equal Absolute Value (Easy Version)
Contest
Educational Round 1
Language
C++17 (G++ 13.2.0)
Submit At
2025-07-14 16:35:07
Judged At
2025-07-14 16:35:07
Judged By
Score
100
Total Time
88ms
Peak Memory
9.02 MiB