문제
Problem 2: Painting the Fence (Bronze) [Brian Dean, 2013]
Farmer John has devised a brilliant method to paint the long fence next to his barn (think of the fence as a one-dimensional number line). He simply attaches a paint brush to his favorite cow Bessie, and then retires to drink a cold glass of water as Bessie walks back and forth across the fence, applying paint to any segment of the fence that she walks past.
Bessie starts at position 0 on the fence and follows a sequence of N moves
PROBLEM NAME: paint
입력
* Line 1: The integer N.
* Lines
출력
* Line 1: The total area covered by at least 2 coats of paint.
예제1
6
2 R
6 L
1 R
8 L
1 R
2 R
6
INPUT DETAILS:
Bessie starts at position 0 and moves 2 units to the right, then 6 to the left, 1 to the right, 8 to the left, and finally 3 to the right.
OUTPUT DETAILS:
6 units of area are covered by at least 2 coats of paint. This includes the intervals