五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(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的評論 (共 條)

分享到微博請遵守國家法律
平遥县| 五峰| 湘乡市| 北票市| 嵊州市| 泌阳县| 南澳县| 高清| 周至县| 庄浪县| 霍州市| 延寿县| 莎车县| 西贡区| 古田县| 云林县| 来安县| 岳阳县| 招远市| 高淳县| 竹溪县| 肥西县| 克什克腾旗| 漳州市| 荃湾区| 河池市| 铜梁县| 洛宁县| 海原县| 綦江县| 贵州省| 玛曲县| 大埔区| 安多县| 新竹县| 通许县| 汝州市| 广昌县| 中方县| 平原县| 邹平县|