Memory Exceeded
Code
#include<bits/stdc++.h>
using namespace std;
int T;
int x;
int coun = 0;
vector<pair<int, int>>arr;
int gcd(int a, int b){
if(a % b == 0) return b;
return gcd(b, a%b);
}
int main(){
cin >> T;
while(T--){
cin >> x;
for(int i = 1; i <= x ; i++){
for(int j = i; j <= x; j++){
if(i != j){
arr.push_back({i, j});
}
}
}
for(auto a: arr){
if(gcd(a.first, a.second) == abs(a.first - a.second)){
coun++;
}
}
cout << coun << endl;
arr.clear();
coun = 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:35:15
- Judged At
- 2025-07-14 17:35:15
- Judged By
- Score
- 0
- Total Time
- ≥1098ms
- Peak Memory
- ≥64.016 MiB