Advertisement
a53

croseta

a53
Feb 6th, 2020
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int n,cx;
  4.  
  5. int cb(int st,int dr)
  6. {
  7. int m=(st+dr)/2,s=m,x=m;
  8. while(x)
  9. if(x>=2&&x<=5)
  10. ++s,x=0;
  11. else
  12. x/=3,s+=x;
  13. if(2*s==n)
  14. return m;
  15. else
  16. if(2*s<n)
  17. return cb(m+1,dr);
  18. else
  19. return cb(st,m-1);
  20. }
  21.  
  22. int main()
  23. {
  24. ifstream f("croseta.in");
  25. f>>n;
  26. ofstream g("croseta.out");
  27. g<<cb(2,n);
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement