?
#include<stdio.h>
#include<string.h>
#include<math.h>
double amount(double list[], int n, double min)
{
int i;
double sum = 0, cheap = list[0];
for (i = 0; i < n; i++)
{
sum = sum + list[i];
if (list[i] < cheap) //找出最小的
cheap = list[i];
}
if (n < 5)
{
return sum;
}
else if (sum < min)
{
return sum;
}
else
{
return sum - cheap;
}
}
int main()
{
int n;
double min,sum;
double list[100];
scanf("%d %lf", &n, &min);
for (int i = 0; i < n; i++)
{
scanf("%lf", &list[i]);
}
sum = amount(list, n, min);
printf("%.2f", sum);
return 0;
}