#P7659. [COCI 2014/2015 #5] FUNGHI
[COCI 2014/2015 #5] FUNGHI
Description
Hansel and Gretel got a pizza cut into slices. Each slice has a different number of mushrooms, denoted by . Gretel really likes mushrooms, so she wants to find four consecutive slices whose total number of mushrooms is as large as possible.
Note that since the pizza is circular, slice is adjacent to slice .
Input Format
There are lines in total, each containing one non-negative integer (where is the line number), representing the number of mushrooms on that slice.
Output Format
Output one integer on a single line: the maximum number of mushrooms on four consecutive slices.
5
2
1
4
5
1
2
3
12
2
6
5
3
3
7
2
6
19
Hint
For of the testdata, .
Translated from COCI 2014/2015 CONTEST #5。
Translated by ChatGPT 5
京公网安备 11011102002149号