当前位置:网站首页>Optimal Parking
Optimal Parking
2022-06-25 06:01:00 【llvYeriji】
translate :
describe :
When shopping on the long street , Michael usually parks his car at a random location , Then walk to the store he needs .
Can you help Michael choose a parking place that can minimize his walking distance while shopping ?
The long street is a straight line , All positions are integers .
You pay for parking at a specific location , This position is the integer position on the long street . however , Michael doesn't want to pay for multiple parking spaces . He's strong , Don't mind carrying all your bags .
Input :
The first line of input gives the number of test cases ,1 <= t <= 100. Each test case has two lines . The first one gives Michael The number of stores you want to go ,1 <= n <= 20, The second one gives them what they are doing in Long Street Upper n Integer positions ,0 <= xi <= 99.
Output :
Output a line of the minimum distance Michael must walk under the best parking conditions for each test case .
边栏推荐
- MySQL transaction learning notes (I) first encounter
- SAP ui5 date type sap ui. model. type. Analysis of date parsing format
- SAP ui5 tutorial for beginners part XXVI - detailed steps for using OData service with mock server trial version
- Word quickly makes multiple single-sided table labels, number plates, etc
- Multithreading and thread pool
- Use of arrays tool class
- Do you know what a three-tier architecture is?
- Some common errors and solutions of using SAP ui5 to consume OData services
- Day16 (regular expression, enumeration)
- Classic usage of the sumproduct function
猜你喜欢
SAP ui5 tutorial for beginners part XXVI - detailed steps for using OData service with mock server trial version
MySQL transaction learning notes (I) first encounter

【LeetCode】40. Combined summation II (2 strokes of wrong questions)

ERDAS 9.2 installation tutorial

MySQL tuning -- 02 -- slow query log
Various errors and solutions encountered when deploying SAP ui5 application to ABAP server with SAP Fiori tools
[golang] leetcode intermediate - Search rotation sort array & search two-dimensional matrix II
[interview with a large factory] meituan had two meetings. Was there a surprise in the end?

Word quickly makes multiple single-sided table labels, number plates, etc
Some common errors and solutions of using SAP ui5 to consume OData services
随机推荐
Day22(File,DiGui,FileOutputStream)
Incorrect dependency of POM file
Use of pytorch tensorboard
JS implementation mouse can achieve the effect of left and right scrolling
DOM proficient? What is the difference between node and elment?
Uni app wechat applet customer service chat function
Is the securities account of Qiantang education safe? Is it reliable?
MySQL uses the where condition to find strange results: solve
Mongodb basic concept learning - Documentation
Uname command – displays system information
SAP ui5 application development tutorial XXIX - Introduction to routing and navigation functions of SAP ui5 trial version
PAT (Advanced Level) Practice 1025
Vscode voice notes to enrich information (medium)
Day16 (regular expression, enumeration)
Multithreading and thread pool
Interview experience - list of questions
Interface learning
Classic usage of the sumproduct function
Feignclient reported an error npe:null
TFTP command – uploading and downloading files