fork download
  1. #include<bits/stdc++.h>
  2. #define pb push_back
  3. #define mp make_pair
  4. #define Foreach(i, c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
  5. #define ll long long int
  6. #define pr(x) cout<<x<<endl;
  7. #define M 1000000007
  8. #define rep(i,k,n) for(ll i=(k);i<=(n);i++)
  9. #define per(i,k,n) for(ll i=(k);i>=(n);i--)
  10. using namespace std;
  11. const int MAX=1000005;
  12. long long int p,pos1,pos2,q,w,l,ans=0,r,y,z,m,t,c=0,res=1;
  13. string s; char ch;
  14. ll mn=0x3f3f3f3f,cnt=1;//,mx=-1000;
  15. int freq[103];
  16. //vector<int> st;
  17. bool mark[5050]={false};
  18. using namespace std;
  19. ll n,k;
  20. bool fun(ll n,ll m){
  21. ll t=n;
  22. ll res=0;
  23. while(t>0){
  24. res+=min(t,m);
  25. t-=min(t,m);
  26. t-=(t/10);
  27. }
  28. if(2*res>=n) return true;
  29. return false;
  30. }
  31. void binary(ll n){
  32. ll l=1, r=n+1, m;
  33. while(l<=r){
  34. m=(r+l)/2;
  35. if( fun(n,m) ) r=m-1;
  36. else l=m+1;
  37. }
  38. cout<<m;
  39. }
  40.  
  41. int main() {
  42. ll n;
  43. cin>>n;
  44. binary(n);
  45. return 0;
  46. }
Success #stdin #stdout 0s 4540KB
stdin
68
stdout
3