News from this site

 Rental advertising space, please contact the webmaster if you need cooperation


+focus
focused

classification  

no classification

tag  

no tag

date  

2024-11(7)

Huawei OD machine test - shortest plank length (Java & JS & Python)

posted on 2023-05-03 20:21     read(613)     comment(0)     like(8)     collect(4)


topic description

Xiao Ming has n planks, and the length of the i ( 1 ≤ i ≤ n ) plank is ai.
Xiao Ming bought a piece of wood with a length of m. This piece of wood can be cut into any pieces and spliced ​​to the existing plank to lengthen the plank.
Xiao Ming wants the shortest template to be as long as possible. May I ask how long the shortest board can be after Xiao Ming lengthens the board?

enter description

The first line of input contains two positive integers, n ( 1 ≤ n ≤ 10^3 ), m ( 1 ≤ m ≤ 10^6 ), n represents the number of boards, and m represents the length of the board.
The second line of input contains n positive integers, a1, a2,…an ( 1 ≤ ai ≤ 10^6 ).

output description

The only line of output contains a positive integer, indicating the maximum length of the shortest plank after lengthening the plank?

Example

enter 5 3
4 5 3 5 5
output 5
illustrate Increase the length of the first plank by 1, and increase the length of the third plank by 2.
The length of these five planks becomes [5,5,5,5,5], the shortest plank


Category of website: technical article > Blog

Author:kkkkkkkkkkdsdsd

link:http://www.pythonblackhole.com/blog/article/269/4d1c2dcf79ed135aebe2/

source:python black hole net

Please indicate the source for any form of reprinting. If any infringement is discovered, it will be held legally responsible.

8 0
collect article
collected

Comment content: (supports up to 255 characters)