1. Suppose n customers are waiting for a service at the same time. The service time required by customer i is ti(1<=i<=n). How to arrange the service order of n customers so that the total waiting time of customers can be minimized?
n=int(input('请输入顾客的位数: '))
times=[]for i inrange(n):
time=int(input(f'请输入顾客{
i+1}的服务时间: '))
times.append(time)
times.sort()
total_time=0for i, time inenumerate(times):
total_time += time
print(f'服务顾客{
i+1},等待时间为{
total_time}')print(f'总的等待时间为{
total_time}分钟')