P2205 [USACO13JAN] Painting the Fence S

题目描述

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 (1

输入格式

输出格式

说明/提示

PS1:来源:usaco jan silver P01 想看原题的请戳http://www.usaco.org/index.php?page=viewproblem2&cpid=226) PS2:测试数据也可以在在http://www.usaco.org/index.php?page=jan13problems上下载,还可以看到题解(不过是英文的:-D) PS3:如果有翻译的问题或题目的不理解,可以在问答后面留言的说。