|
|||
The Turtle and the SnailThe turtle and the snail are playing the following game: they stand at the two ends of a small clearing, facing each other. The midpoint of the imaginary straight line joining their positions is designated as the goal, and for a given signal, they begin to run towards that point. Write a program that processes the data of such a race. The first line of the input contains a positive integer (n) that specifies the number of minutes that this noble competition lasted. Each of the next two lines contains n nonnegative integers. The numbers in a line are separated by exactly one space character. The first n numbers specify how many centimeters the turtle travelled each minute during the race, and the second n numbers give the same information for the snail. The race ends after n minutes, then one (or both) of them reaches the goal.
Your program should write in the first line of the standard output the total length of the race track in centimeters.
In the second line, depending on which competitor has reached the midpoint, write the word „ Sample Input 1
Output for Sample Input 1
Sample Input 2
Output for Sample Input 2
Sample Input 3
Output for Sample Input 3
Acknowledgement
This work was supported by the construction EFOP-3.4.3-16-2016-00021. The project was supported by the European Union, co-financed by the European Social Fund.
|
|||
University of Debrecen; Faculty of Informatics; v. 09/30/2024 |