
➤ Problem Link : ATOMS
👉 Hint : Log formula and Long integer
✅ C++ Solution :
#include<bits/stdc++.h>
using namespace std;
#define ld double
#define ll long long int
int main()
{
int p;
cin>>p;
while(p--)
{
ld n,k,m;
cin>>n>>k>>m;
if(m<=n)
cout<<"0"<<endl;
else
{
ll ans=log10(m/n)/log10(k);
cout<<ans<<endl;
}
}
}
I am a Member Technical at D.E. Shaw India Pvt. Ltd. CodingWithArt is a blog where you find tricks and solutions to challenging coding and development problems. I aim to build a universal tech platform for every enthusiast out there.