当前位置:网站首页>Maximum area of solar panel od js
Maximum area of solar panel od js
2022-07-31 02:19:00 【Big chicken thighs are the best】
Title: Maximum area of solar panels | Time limit: 1 second | MemoryLimit: 32768K | Language Limit: Unlimited
To install a rectangular or square solar panel on one side of the spacecraft (the red slashed area in the picture), you need to install two pillars (black vertical bars in the picture) first, and then fix the solar panel in the middle part of the pillars.However, the length of the pillars at different positions of the spacecraft is different, and the installation area of the solar panel is limited by the length of the pillar on the shortest side.As shown:

Now provide a set of column height data in a shaped array. Assuming that the distance between each column is equal to 1 unit length, calculate how to select two columns to maximize the area of the solar panel.
Enter a description:
10,9,8,7,6,5,4,3,2,1
Note: There are at least 2 pillars and a maximum of 10000 pillars, and the supported height ranges from 1 to 10^9 integers.The heights of the pillars are unordered, and the decrease in the example is just a coincidence.
Output description:
Maximum solar panel area that can be supported: (between 10m high pillars and 5m high pillars)
25
Example 1
Enter
10,9,8,7,6,5,4,3,2,1
Output
25
Note:
The width between the 10-meter-high pillar and the 5-meter-high pillar is 5, and the height of the smaller pillar is also 5, and the area is 25.Take the other two
边栏推荐
猜你喜欢
随机推荐
mysql 视图
Hanyuan Hi-Tech 8-channel HDMI integrated multi-service high-definition video optical transceiver 8-channel HDMI video + 8-channel two-way audio + 8-channel 485 data + 8-channel E1 + 32-channel teleph
Software Testing Defect Reporting - Definition, Composition, Defect Lifecycle, Defect Tracking Post-Production Process, Defect Tracking Process, Purpose of Defect Tracking, Defect Management Tools
Brute Force/Adjacency Matrix Breadth First Directed Weighted Graph Undirected Weighted Graph
加密生活,Web3 项目合伙人的一天
leetcode-1161: Maximum in-layer element sum
uniapp uses 3rd party fonts
[1154]如何将字符串转换为datetime
Is there a way to earn 300 yuan a day by doing a side business?
STM32CUBEMX开发GD32F303(11)----ADC在DMA模式下扫描多个通道
Manchester City confuses fans with smart scarf that detects emotions
My first understanding of MySql, and the basic syntax of DDL and DML and DQL in sql statements
Interprocess communication study notes
【Bank Series Phase 1】People's Bank of China
Verify the integer input
医疗影像领域AI软件开发流程
Inner monologue from a female test engineer...
ShardingJDBC usage summary
"Cloud native's master, master and vulgar skills" - 2022 National New College Entrance Examination Volume I Composition
力扣刷题之有效的正方形(每日一题7/29)







