国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

CF 474A - Keyboard

2023-08-22 14:57 作者:您是打尖兒還是住店呢  | 我要投稿

Mike is trying rock climbing but he is awful at it.


There are n holds on the wall, i-th hold is at height ai off the ground. Besides, let the sequence ai increase, that is, ai?<?ai?+?1 for all i from 1 to n?-?1; we will call such sequence a track. Mike thinks that the track a1, ..., an has difficulty . In other words, difficulty equals the maximum distance between two holds that are adjacent in height.


Today Mike decided to cover the track with holds hanging on heights a1, ..., an. To make the problem harder, Mike decided to remove one hold, that is, remove one element of the sequence (for example, if we take the sequence (1,?2,?3,?4,?5) and remove the third element from it, we obtain the sequence (1,?2,?4,?5)). However, as Mike is awful at climbing, he wants the final difficulty (i.e. the maximum difference of heights between adjacent holds after removing the hold) to be as small as possible among all possible options of removing a hold. The first and last holds must stay at their positions.


Help Mike determine the minimum difficulty of the track after removing one hold.


Input

The first line contains a single integer n (3?≤?n?≤?100) — the number of holds.


The next line contains n space-separated integers ai (1?≤?ai?≤?1000), where ai is the height where the hold number i hangs. The sequence ai is increasing (i.e. each element except for the first one is strictly larger than the previous one).


Output

Print a single number — the minimum difficulty of the track after removing a single hold.

-----------------------------------------

邁克正在嘗試攀巖,但他的表現(xiàn)很糟糕。


墻上有 n 個據(jù)點,第 i 個據(jù)點位于距地面高度 ai 處。 另外,讓序列ai遞增,即對于所有i從1到n?-?1,ai?<?ai?+?1; 我們將這樣的序列稱為軌道。 Mike 認(rèn)為軌道 a1, ..., an 有困難。 換句話說,難度等于高度相鄰的兩個點之間的最大距離。


今天,邁克決定用懸掛在高度 a1, ..., an 上的支撐點覆蓋賽道。 為了使問題變得更難,Mike 決定刪除一個保留,即刪除序列中的一個元素(例如,如果我們采用序列 (1,?2,?3,?4,?5) 并從中刪除第三個元素, 我們得到序列 (1,?2,?4,?5))。 然而,由于 Mike 的攀爬能力很差,他希望在所有可能的移除抓點的選項中,最終的難度(即移除抓點后相鄰抓點之間的最大高度差)盡可能小。 第一個和最后一個保持點必須保持在原來的位置。


幫助邁克確定取消一個握點后賽道的最低難度。


輸入

第一行包含一個整數(shù) n (3?≤?n?≤?100) — 保持的數(shù)量。


下一行包含 n 個空格分隔的整數(shù) ai (1?≤?ai?≤?1000),其中 ai 是保持編號 i 懸掛的高度。 序列 ai 正在增加(即除了第一個元素之外的每個元素都嚴(yán)格大于前一個元素)。


輸出

打印一個數(shù)字——移除單個支撐后賽道的最低難度。

---------------------------------------------

每次保存2個變量,然后根據(jù)變量去處理即可。

CF 474A - Keyboard的評論 (共 條)

分享到微博請遵守國家法律
襄樊市| 黑山县| 霍州市| 会宁县| 江孜县| 额济纳旗| 荆门市| 凤城市| 旺苍县| 哈密市| 涞源县| 沈阳市| 泗洪县| 南雄市| 南川市| 简阳市| 定日县| 汉沽区| 海兴县| 娄烦县| 太仓市| 陇川县| 措美县| 岳池县| 钟祥市| 东源县| 成武县| 三门县| 从江县| 三门峡市| 建宁县| 佛坪县| 深圳市| 磐安县| 南澳县| 正阳县| 永丰县| 东兰县| 通化县| 汉源县| 永济市|