Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 40121

Getting TLE for ATOM

$
0
0

Question : ATOM

This is my code for above question

#include<iostream>
#include<cstdio>

using namespace std;

long long int get_num()
{
 long long int num=0;
 char c=getchar_unlocked();
 while(!(c>='0' && c<='9'))
 c=getchar_unlocked();
 while(c>='0' && c<='9')
 {
  num=(num<<3)+(num<<1)+c-'0';
  c=getchar_unlocked();
 }
return num;
}

 int main()
 {
 long long int t=get_num();
 while(t--)
 {
  long long int n=get_num();
  long long int k=get_num();
  long long int m=get_num();
  int count=0;
  n*=k;
  while(n<=m)
  {
   count++;
   n*=k;
  }
  cout<<count<<endl;
  }
return 0;
}

Many other solutions with a similar code have got accepted with much less runtime. Explain what's that causing for TLE in this solution.


Viewing all articles
Browse latest Browse all 40121

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>