/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 492ms 4.367 MiB
#2 Accepted 656ms 5.012 MiB
#3 Accepted 661ms 5.121 MiB
#4 Accepted 698ms 4.957 MiB
#5 Accepted 708ms 5.113 MiB

Code

#pragma GCC optimize("O3,unroll-loops")
#include<bits/stdc++.h>
using namespace std;

#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
const int N = 1000007 ;

int a[N] ;

void pre() {
  for(int i = 1 ; i < N ; i ++) {
        for(int j = 2 * i ; j < N ; j += i) {
          if(gcd(j , j - i) == i) a[j] ++ ;
        }
        a[i] += a[i - 1] ;
      }
}
void solve() {
       
      int n ;
      cin >> n ;
      cout << a[n] << endl ;

       
}









int main() {

    fastio();
    int t = 1;
    cin >> t;
    pre() ;
    while (t--) solve();
}

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:54:07
Judged At
2025-07-14 16:54:07
Judged By
Score
100
Total Time
708ms
Peak Memory
5.121 MiB