Skip to content

Instantly share code, notes, and snippets.

@harsh-2024
Created September 17, 2022 08:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harsh-2024/d2f6f5ff6cd0e07dda7b631dee790918 to your computer and use it in GitHub Desktop.
Save harsh-2024/d2f6f5ff6cd0e07dda7b631dee790918 to your computer and use it in GitHub Desktop.
This is the solution of the first problem given in the Coding Contest of Reload22
#include <bits/stdc++.h>
using namespace std;
int main() {
int t; cin>>t;
while(t--) {
long long n; cin>>n;
long long ans = 0;
// pairs in which lcm/gcd=1
ans+=n;
//pairs in which lcm/gcd=2
ans+=(n/2)*2;
//pairs in which lcm/gcd=3
ans+=(n/3)*2;
cout<<ans<<'\n';
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment