fork download
  1. #include <iostream>
  2. #include <cmath>
  3. #include <iomanip>
  4. using namespace std;
  5.  
  6. int main() {
  7. double h, w, tmp = 0, ans = 0;
  8. cin >> h >> w;
  9. if(w < h) {
  10. tmp = h;
  11. h = w;
  12. w= tmp;
  13. }
  14. if(w >= 3*h) {
  15. ans = h;
  16. }
  17. else {
  18. ans = max(h / 2, w / 3);
  19. }
  20. cout << fixed << setprecision(4) << ans;
  21. }
Success #stdin #stdout 0s 4532KB
stdin
30 11
stdout
10.0000