luogu#P1614. 爱与愁的心痛
爱与愁的心痛
Background
(This problem hides two song titles. See if you can find them~~~).
"The Story of 'Love and Sorrow', Vol. 1 · heartache", Chapter 1.
In "Wo Wei Ge Kuang", Wu Sikai's hit song "Dancing Moonlight" actually did not beat Sa Dingding. The guru "Ai Yu Chou" feels heartbroken~~~ Also, some sad things have happened lately, all of which make the heart ache (it has really been annoying lately).
Problem Description
Recently there are unpleasant events, and each one has a positive integer sting value (his tolerance is extremely low). The guru "Ai Yu Chou" wants to know the minimum sum of consecutive sting values. Because he is busy, he asks you to write a program to tell him.
Input Format
The first line contains two space-separated integers, and .
Lines to each contain one integer. For , line contains an integer , the sting value of the -th event.
Output Format
Output one line with a single integer: the minimum sum of any consecutive sting values.
8 3
1
4
7
3
1
2
4
3
6
Hint
Constraints
- For of the testdata, it is guaranteed that .
- For of the testdata, it is guaranteed that .
- For of the testdata, it is guaranteed that .
- For of the testdata, it is guaranteed that , .
Translated by ChatGPT 5