Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- long long t,p,r,f,y,x;
- cin>>t;
- while(t!=0)
- {
- cin>>r>>p>>f;
- if(r==1)
- {
- y=1;
- while(f>p)
- {
- x=p;
- p=p+x;
- y=y+1;
- }
- }
- else
- {
- y=0;
- while(f>=p)
- {
- p=r*p;
- y=y+1;
- }
- }
- cout<<y<<endl;
- t=t-1;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment