求助

biggayboy 2021-05-29 19:40:16

#include<stdio.h>
#include<iostream>
using namespace std;
int n;
int a[1010];
int a1,a2,a3;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=i;j<=n;j++)
		{
			if(a[i]>a[j]) swap(a[i],a[j]);
		}
	}
	int time=(n-5)*a[2]*2;
	int time1=0,time2=0;
	time1=a[1]+a[2]+a[3];
	time2=5*a[2];
	time+=min(time1,time2);
	printf("%d",time);
	return 0;
	
}