11364 - Parking

 C: Optimal Parking 

When shopping on Long Street, Michael usually parks his car at some random location, and then walks to the stores he needs. Can you help Michael choose a place to park which minimises the distance he needs to walk on his shopping round?

\epsfbox{p11364.eps}

Long Street is a straight line, where all positions are integer. You pay for parking in a specific slot, which is an integer position on Long Street. Michael does not want to pay for more than one parking though. He is very strong, and does not mind carrying all the bags around.

Input 

The first line of input gives the number of test cases, 1$ \le$t$ \le$100. There are two lines for each test case. The first gives the number of stores Michael wants to visit, 1$ \le$n$ \le$20, and the second gives their n integer positions on Long Street, 0$ \le$xi$ \le$99.

Output 

Output for each test case a line with the minimal distance Michael must walk given optimal parking.

Sample Input 

2 
4 
24 13 89 37 
6 
7 30 41 14 39 42

Sample Output 

152
70

#include<stdio.h>
int main()
{
	int t,n,i,a[25];
	scanf("%d",&t);
	while(t--)
	{
		scanf("%d",&n);
		int max=-1,min=100;
		for(i=0;i<n;i++)
		{
			scanf("%d",&a[i]);
			max=a[i]>max?a[i]:max;
			min=a[i]<min?a[i]:min;
		}
		printf("%d\n",(max-min)*2);
	}
	return 0;
}

基于SpringBoot的Smart-Parking智慧停车场项目,是一个利用物联网和云计算技术打造的智能化停车解决方案。该项目的目标是通过实时数据采集和分析,提供用户便捷的停车体验,并实现停车场资源的最优化利用。 Smart-Parking项目的主要特点包括以下几个方面: 1. 实时数据采集:项目利用传感器和智能设备对停车场内的车辆、车位等信息进行实时采集,实现停车场的数据化管理和监控。 2. 车辆导航和停车引导:通过与用户手机终端的配合,项目能够帮助用户找到可用的车位并提供导航功能,实现快速停车和减少寻找车位的时间。 3. 支付结算和电子收据:项目支持多种支付方式,包括微信支付、支付宝等,并生成电子收据供用户查阅。这样可以方便用户结算停车费用,并提供更加便捷的管理方式。 4. 数据统计和优化:项目能够对停车场的使用情况进行数据分析和统计,包括停车位利用率、高峰期预测等,帮助停车场管理者进行资源优化和管理决策。 5. 安全和便捷性:项目注重用户的安全和便捷,利用视频监控设备提供停车场的安全保障,并通过人工智能算法实现车辆的自动识别和安全管理。 总而言之,基于SpringBoot的Smart-Parking智慧停车场项目使用新兴的物联网和云计算技术,利用实时数据采集和分析,为用户提供便捷的停车体验,并帮助停车场管理者实现资源优化和决策支持。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值