Created
September 17, 2022 08:16
-
-
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
This file contains hidden or 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