Problem A. Alex Origami Squares

AC代码(分三种情况)

Select Code

#include <bits/stdc++.h>
#include <iostream>
using namespace std;

int main()
{
    freopen("alex.in", "r", stdin);
    freopen("alex.out","w",stdout);
      double  h, w, t, r;
      scanf("%lf %lf",&h, &w);
      if(w>h)
      {
          t = w, w = h, h = t;
      }
      if(w>=2.0/3*h)
      {
          r = w/2.0;
      }
      else if(w>=1.0/3*h)
      {
          r = h/3.0;
      }
      else
        r = w;
      printf("%.6lf\n",r);
    return 0;
}

猜你喜欢

转载自blog.csdn.net/qq_41524782/article/details/81633716