fork download
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <cmath>
  4. #include <iomanip>
  5. using namespace std;
  6.  
  7. int main() {
  8. double h, w, ans = 0;
  9. cin >> h >> w;
  10. if (w < h) {
  11. swap (w, h);
  12. }
  13. ans = ( w >= 3 * h ? h : max (h / 2, w / 3) );
  14. cout << fixed << setprecision(4) << ans;
  15. return 0;
  16. }
Success #stdin #stdout 0s 4520KB
stdin
8 3

stdout
2.6667