L.cpp 426 B

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