Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|

Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |

Language: Bad Hair Day
Description Some of Farmer John's Each cow h≤ 1,000,000,000) and is standing in a line of cows all facing east (to the right in our diagrams). Therefore, cow _{i }i can see the tops of the heads of cows in front of her (namely cows i+1, i+2, and so on), for as long as these cows are strictly shorter than cow i.Consider this example: = Cow#1 can see the hairstyle of cows #2, 3, 4 Let i; please compute the sum of c_{1} through c.For this example, the desired is answer 3 + 0 + 1 + 0 + 1 + 0 = 5._{N}Input Line 1: The number of cows, N.
Lines 2..N+1: Line i+1 contains a single integer that is the height of cow i.Output Line 1: A single integer that is the sum of c_{1} through c._{N}Sample Input 6 10 3 7 4 12 2 Sample Output 5 Source |

[Submit] [Go Back] [Status] [Discuss]

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di

Any problem, Please Contact Administrator