This is the solution of the first problem given in the Coding Contest of Reload22
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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