【入门】求最大梯形的面积c++
·
#include <bits/stdc++.h>
using namespace std;
int main()
{
double n,a,b,h,s,maxx = 1.0;
cin >> n;
for(int i = 1;i <= n;i++)
{
cin >> a >> b >> h;
s = (a + b) * h / 2.0;
maxx = max(maxx,s);
}
cout << fixed << setprecision(1) << maxx;
return 0;
}
更多推荐



所有评论(0)