Advertisement
Guest User

Untitled

a guest
Sep 20th, 2021
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. #define int long long
  3. using namespace std;
  4. void fun(int x,int y)
  5. {
  6.     if(y==1)
  7.     {
  8.         cout<<"-1\n";
  9.     }
  10.     int z=0;
  11.     while(x)
  12.     {
  13.         x=x/y;
  14.         z++;
  15.     }
  16.     cout<<z<<"\n";
  17. }
  18. int32_t main()
  19. {
  20.     int t;
  21.     cin>>t;
  22.     while(t--)
  23.     {
  24.         int x,y;
  25.         cin>>x>>y;
  26.         if(y==1)
  27.         {
  28.             cout<<"-1"<<endl;
  29.             continue;
  30.         }
  31.         else
  32.         {
  33.             int z=0;
  34.             while(x)
  35.             {
  36.                 x=x/y;
  37.                 z++;
  38.             }
  39.             cout<<z<<endl;
  40.         }
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement