解题思路:
注意事项:
参考代码:
#include<iostream> #include<algorithm> #include<utility> #include<limits> #include<iomanip> using namespace std; const int N = 1e4 + 10; int a[N]; int main() { int n,mi = INT32_MAX,sum = 0; while(cin >> n){ for(int i = 1; i <= n; i ++){ cin >> a[i]; sum += a[i]; if(mi > a[i]) mi = a[i]; } if(n == 2) cout << fixed << setprecision(1) << mi*1.0 << endl; else cout << fixed <<setprecision(1) << sum * 1.0/ 2 << endl; sum = 0; mi = INT32_MAX; } return 0; }
0.0分
2 人评分