⌨️

[AtCoder]ABC-376|A - Candy Button

2024/11/07に公開

設問ページ

提出結果

def getIntMap():
    return map(int, input().split())


def getIntList():
    return list(map(int, input().split()))


def main():
    N, C = getIntMap()
    T = getIntList()

    # 初回は貰える
    t = T[0]
    r = 1

    for i in range(1, N):
        if T[i] - t >= C:
            t = T[i]
            r += 1
    print(r)


if __name__ == "__main__":
    main()

Discussion