123456789101112131415161718 |
- #include <bits/stdc++.h>
- using namespace std;
- void fout(double x, int scale = 6) {
- cout << setiosflags(ios::fixed) << setprecision(scale) << x << endl;
- }
- int main(int argc, char const *argv[]) {
- double U, D, H, slope, area, perimeter;
- cin >> U >> D >> H;
- area = (U + D) * H / 2;
- slope = hypot((D - U) / 2, H);
- perimeter = U + D + 2 * slope;
- fout(area, 2);
- fout(perimeter, 2);
- return 0;
- }
|