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

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

Leetcode1176 Diet Plan Performance

2023-01-02 16:39 作者:您是打尖兒還是住店呢  | 我要投稿

A dieter consumes calories[i] calories on the i-th day. For every consecutive sequence of k days, they look at T, the total calories consumed during that sequence of k days:

If T < lower, they performed poorly on their diet and lose 1 point; If T > upper, they performed well on their diet and gain 1 point; Otherwise, they performed normally and there is no change in points. Return the total number of points the dieter has after all calories.length days.

Note that: The total points could be negative.

Example 1:

Input: calories = [1,2,3,4,5], k = 1, lower = 3, upper = 3 Output: 0 Explaination: calories[0], calories[1] < lower and calories[3], calories[4] > upper, total points = 0.

Example 2:

Input: calories = [3,2], k = 2, lower = 0, upper = 1 Output: 1 Explaination: calories[0] + calories[1] > upper, total points = 1.

Example 3:

Input: calories = [6,5,0,0], k = 2, lower = 1, upper = 5 Output: 0 Explaination: calories[0] + calories[1] > upper, calories[2] + calories[3] < lower, total points = 0.

Constraints:

  1. 1 <= k <= calories.length <= 10^5

  • 0 <= calories[i] <= 20000

  • 0 <= lower <= upper

這次的題目是鎖著的,所以只能在GitHub上面找原題,測(cè)試案例只有2個(gè)了,,所以不知道跑數(shù)量級(jí)比較大的時(shí)候,會(huì)不會(huì)報(bào)錯(cuò)了。

數(shù)組也可以循環(huán),只是想用下ArrayList,先遍歷,每次根據(jù)K,求對(duì)應(yīng)的值,即可跑出來數(shù)據(jù)的。

Leetcode1176 Diet Plan Performance的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國家法律
通海县| 梅河口市| 南乐县| 呈贡县| 东乌| 阿尔山市| 鄯善县| 兴文县| 广河县| 宁武县| 缙云县| 泸水县| 疏附县| 洞口县| 施秉县| 诏安县| 久治县| 清流县| 满城县| 永泰县| 昭平县| 安康市| 大埔县| 德昌县| 会理县| 泾源县| 昂仁县| 罗甸县| 志丹县| 斗六市| 东辽县| 来安县| 晋州市| 兴山县| 文化| 富裕县| 丹阳市| 连城县| 陇南市| 永年县| 垣曲县|