链接:
https://www.nowcoder.com/acm/contest/106/I
来源:牛客网
来源:牛客网
It’s universally acknowledged that there’re innumerable trees in the campus of HUST.
There is a row of trees along the East-9 Road which consists of N trees. Now that we know the height of each tree, the gardeners of HUST want to know the super-neatness of this row of trees. The neatness of a sequence of trees is defined as the difference between the maximum height and minimum height in this sequence. The super-neatness of this sequence of trees is defined as the sum of neatness of all continous subsequences of the trees.
Multiple cases please process until the end of input. There are at most 100 test cases.