/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 135ms 15.699 MiB
#2 Accepted 170ms 16.422 MiB
#3 Accepted 159ms 16.699 MiB
#4 Accepted 159ms 16.441 MiB
#5 Accepted 156ms 16.527 MiB

Code

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define endl '\n'
#define ll long long
#define ld long double
#define vi vector<ll>
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define srt(v) sort(v.begin(),v.end())
#define rsrt(v) sort(v.rbegin(),v.rend())
#define rep(i, a, b) for(ll i = (a); i < (b); i++)
#define trace(x) cout<<#x<<": "<<x<<endl;
#define print(v) for(auto e:v) cout<<e<<" "; cout<<endl;
#define printp(v) for(auto e:v) cout<<e.first<<" "<<e.second<<endl;
const int N=1e6+10;
ll arr[N];
ll pre[N];
void solve(){
    ll n;cin>>n;
    cout<<pre[n]<<endl;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    for(int i= 1;i<N;i++){
        for(int j = i*2;j<N;j+=i){
            arr[j]++;
        }
    }
    pre[0] = arr[1];
    for(int i = 2;i<N;i++){
        pre[i] = pre[i-1]+arr[i];
    }
    int t=1;cin>>t;
    for(int i =1;i<=t;i++){
        solve();
    }
    return 0;
}

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 17:41:12
Judged At
2025-07-14 17:41:12
Judged By
Score
100
Total Time
170ms
Peak Memory
16.699 MiB