L.cpp 354 B

1234567891011121314
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main(){
  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. }