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.  
  11. int i,j;
  12. int n,a,b;
  13. cin>>n>>a>>b;
  14. if(a<b)
  15. swap(a,b);
  16. int den1 = int(round(a*n*1.0/(a+b)));
  17. if(den1 == 0)
  18. den1++;
  19. else if(den1 == n)
  20. den1--;
  21. int den2 = n-den1;
  22.  
  23. // cout<<den1<<" "<<den2<<endl;
  24. int aa = a/den1;
  25. int bb = b/den2;
  26. // cout<<aa<<" "<<bb<<endl;
  27. int ans = min(aa,bb);
  28. cout<<ans<<endl;
  29. }
Success #stdin #stdout 0s 4480KB
stdin
Standard input is empty
stdout
-21877