fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. long long MOD=1e9+7;
  5.  
  6. int main()
  7. {
  8. ios_base::sync_with_stdio(false);
  9. cin.tie(0);
  10. int i,j;
  11. int n,a,b;
  12. cin>>n>>a>>b;
  13. if(a<b)
  14. swap(a,b);
  15. int den1 = int(floor(a*n*1.0/(a+b)));
  16. if(den1 == 0)
  17. den1++;
  18. else if(den1 == n)
  19. den1--;
  20. int den2 = n-den1;
  21.  
  22. // cout<<den1<<" "<<den2<<endl;
  23. int aa = a/den1;
  24. int bb = b/den2;
  25. // cout<<aa<<" "<<bb<<endl;
  26. int ans = min(aa,bb);
  27. den1 = int(ceil(a*n*1.0/(a+b)));
  28. if(den1 == 0)
  29. den1++;
  30. else if(den1 == n)
  31. den1--;
  32. den2 = n-den1;
  33. aa = a/den1;
  34. bb = b/den2;
  35. ans = max(ans,min(aa,bb));
  36. cout<<ans<<endl;
  37. }
Success #stdin #stdout 0s 4548KB
stdin
Standard input is empty
stdout
0