当前位置:网站首页>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 .
边栏推荐
- PHP output (print) log to TXT text
- Jenkins installation and configuration
- The e-book "action guide for large organizations to further promote zero code application platform" was officially released!
- Rhcsa day 4
- Cat command – display the file contents on the terminal device
- Day13 (inner class, anonymous inner class, API common class)
- SAP ui5 beginner tutorial No. 28 - Introduction to the integration test tool OPA for SAP ui5 applications
- Use of arrays tool class
- How SAP ui5 device type detection device API works
- 钱堂教育的证券账户安全吗?靠谱吗?
猜你喜欢
C simple operation mongodb
Soft exam information system project manager_ Management Science (Operations Research) 2--- senior information system project manager of soft test 034
RT thread i/o device model and layering
Go language map sorting (key/value sorting)
Excel splits a worksheet into multiple worksheets according to conditions, and how to split multiple worksheets into independent tables
Interface learning
Word quickly makes multiple single-sided table labels, number plates, etc
Do you know what a three-tier architecture is?
SAP ui5 beginner tutorial No. 28 - Introduction to the integration test tool OPA for SAP ui5 applications
Getting started with Silverlight development 1
随机推荐
[open source sharing] deeply study KVM, CEPH, fuse features, including open source projects, code cases, articles, videos, architecture brain maps, etc
What are the reasons why most webmasters choose Hong Kong site group servers?
Introduction to sap ui5 tools
Understanding of process, thread, task queue, event loop, macro task, micro task, execution stack and other concepts in JS
Use generator-easy-ui5 to quickly create the engineering structure of SAP ui5 applications
Soft exam information system project manager_ Information system security management - Senior Information System Project Manager of soft test 026
Websocket in the promotion of vegetable farmers
Configuration file ui5 local in SAP ui5 tools Configuration points of yaml
Timed thread pool
Linus' speech recordings, which were lost in 1994, were made public
Vscode voice notes to enrich information (medium)
Soft exam information system project manager_ Management Science (Operations Research) -- senior information system project manager of soft test 033
Mongodb basic concept learning - Documentation
Go quiz: considerations for function naming return value from the go interview question (more than 80% of people answered wrong)
Create a complete binary tree in array order
Tail command – view the contents at the end of the file
Yunda's cloud based business in Taiwan construction 𞓜 practical school
HashSet implementation class
MySQL -- optimize query statements and use not in with cases
Differences and connections between sap ui5 and openui5