When highways are being worked on, the repair crews use Orange Barrels to tell you when you can/should move over (lanes are closed or they re-open). The Larry-Darrel-Darrel Construction Company always puts 13 Orange Barrels before a lane ends (13 per each lane). They always put 9 Orange Barrels when you regain a lane. You are to read in a series of lane widths and determine how many barrels you see while traveling that stretch of road and how many times the number of lanes changes.
Sample Input Data:
3
2
4
3
0
4
5
2
3
4
5
6
3
4
5
0
-1
NOTE: Each highway will end when you encounter a zero (0). You will stop processing when you encounter a negative one (-1).
Sample Output:
This highway changed width 3 times and we saw 44 Orange Barrels.
This highway changed width 9 times and we saw 141 Orange Barrels.
NOTE: Do not worry about the formatting of numeric output (leading/trailing spaces around numbers are acceptable).
Explanation of Calculation:
The highway 3 2 4 3 would be calculated as follows:
Return to the Top of Page, First Page, Novice Problem Set, or Veteran Problem Set.
Return to the Top of Page, First Page, or Novice Problem Set.
Return to the LSU High School Programming Contest Homepage