L.cpp 384 B

123456789101112131415
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main(int argc, char const *argv[]) {
  4. double U, D, H, slope, area, perimeter;
  5. cin >> U >> D >> H;
  6. area = (U + D) * H / 2;
  7. slope = hypot((D - U) / 2, H);
  8. perimeter = U + D + 2 * slope;
  9. cout << fixed << setprecision(2) << area << endl;
  10. cout << fixed << setprecision(2) << perimeter << endl;
  11. return 0;
  12. }