UVA413 Up and Down Sequences

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=6&page=show_problem&problem=354 [PDF](https://uva.onlinejudge.org/external/4/p413.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA413/be926b1f837340e46e362e0523ebca38c7c23f6d.png)

Input Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA413/13e287796ad9ddac082525c8aa089fbf86ba4140.png)

Output Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA413/73f907b4b6dfff3a85abf831a18a714a46e24c15.png)