UVA12964 The Cup Turning Machine

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=862&page=show_problem&problem=4843 [PDF](https://uva.onlinejudge.org/external/129/p12964.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12964/b515075ddc5ceea1aa62d2dcafb7e698f8df7bae.png)

Input Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12964/f2ef165a6ceaefea84a0294f442c563484735805.png)

Output Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12964/bf07f38dea17e03f23e1022870e67e78d4eb97e4.png)