D2C101 - Editorial

PROBLEM LINK:

Contest

Author: Pradeep Kumar Sahu
Tester: Sumeet Pachauri
Editorialist: Pradeep Kumar Sahu

DIFFICULTY:

Cakewalk

PREREQUISITES:

Basic observations , Maths

PROBLEM:

You are given a positive integer N.
Your task is to calculate total number of pairs (i,j) such that 1\leq i, j \leq N and HCF(i,j) = LCM(i,j) .
Here HCF denotes the highest common factor and LCM denotes the lowest common multiple.

EXPLANATION:

We know that LCM of two numbers = HCF of same two numbers only when both numbers are equal.
So solution pairs will be : (1,1) , (2,2) , (3,3) , (4,4) , … , (N,N).
Hence the answer will be N itself.

TIME COMPLEXITY:

Time complexity is O(1) per test cases.

SOLUTIONS:

Setter's Solution
#include<bits/stdc++.h>
using namespace std;  

int main()
{
    int t;
    cin >> t;
    while(t--)
    {
        int n;
        cin >> n;
        cout << n << "\n" ;
    }
    return 0;
}
Tester's Solution
/*
Author : Sumeet Pachauri
Codeforces : sumeet_4275
CodeChef : kaalbhairav01 
________________________________________
¦-____¦_-¦¦-_¦_-¯¦¯-_¦_-__-¦_-__-¦-_-_-¦
¦____-¦¦-¦¦-¦#¦-¦_¦-¦#¦-_¦¯¦¦-_¦¯¦¦¦-¦¦¦
¯_____¯¯____¯¯___¯___¯_____¯_____¯¯___¯¯
*/

#include "bits/stdc++.h"
using namespace std;
#define int               long long
#define pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define fastio			  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(x)            (x).begin(),(x).end()
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
#define sz(x)             (int)((x).size())
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define r0                return 0
#define test			  int T; cin>>T; while(T--)
#define ppc               __builtin_popcount
#define ppcll             __builtin_popcountll
#define mod				  1000000007

void solve()
{ 		
	int n;
	cin>>n;
	assert(n>=1);
	assert(n<=1000000000);
	cout<<n<<endl;
} 

signed main(){
	fastio
	
	test
	{	assert(T<=100000);
		solve();
	}
	r0;
}

For doubts, please leave them in the comment section, I’ll address them.