Advertisement
Saleh127

at 146C

Sep 23rd, 2020
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  5. ll a,v,x,lo=0,hi=1000000001,mid,i,j,k,l;
  6.  
  7. bool valid(ll xx)
  8. {
  9. ll ss=xx;
  10. ll f,g=0,dd;
  11. while(ss>0)
  12. {
  13. ss/=10;
  14. g++;
  15. }
  16.  
  17. f=a*xx+v*g;
  18.  
  19. return f<=x;
  20. }
  21.  
  22. int main()
  23. {
  24. ios_base::sync_with_stdio(0);
  25. cin.tie(0);cout.tie(0);
  26.  
  27. cin>>a>>v>>x;
  28.  
  29. while(lo+1<hi)
  30. {
  31. mid=(lo+hi)/2;
  32. if(valid(mid))
  33. {
  34. lo=mid;
  35. }
  36. else hi=mid;
  37. }
  38. cout<<lo<<endl;
  39.  
  40. return 0;
  41. }
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement