fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. int p;
  7. long long unsigned int n,k,m;
  8. cin>>p;
  9. for(int i=0;i<p;i++)
  10. {
  11. cin>>n>>k>>m;
  12. int count = 0;
  13. if (n==m)
  14. {
  15. cout<<count<<"\n";
  16. }
  17. else
  18. {
  19. while(n<=m)
  20. {
  21. n=n*k;
  22. count++;
  23. }
  24. cout<<count<<"\n";
  25. }
  26. }
  27. return 0;
  28. }
Success #stdin #stdout 0s 3100KB
stdin
2
2 2 7
2 2 8
stdout
2
3