#P14743. [ICPC 2021 Seoul R] Squid Game
[ICPC 2021 Seoul R] Squid Game
题目描述
:::align{center}
:::
You are one of the players participating in a series of children's games with deadly penalties. Passing through a number of maze-like hallways and stairways, you have opened the gate of the next game. There are three buckets with infinite capacity, each of which contains an integral number of liters of water. The buckets are numbered from to . The amounts of water initially contained in buckets , , and are given as , , and , respectively.
At any time, you can double the amount of one bucket by pouring into it from another one. Specifically, you can pour from a bucket of liters into one of () liters until the latter contains liters and the former does liters. Note that and are always integers and . See the Figure J.1.
:::align{center}

Figure J.1 A process of pouring :::
In order to survive, you have to empty one of the buckets in a limited number of pouring. Fortunately, it is always possible to empty one of the buckets. Given the initial amounts , , and of water in three buckets, write a program to output a sequence of pouring until one of the buckets is empty for the first time.
输入格式
Your program is to read from standard input. The input starts with a line containing three integers , , and (), representing the initial amounts of water in buckets , , and , respectively.
输出格式
Your program is to write to standard output. The first line should contain the number of pouring until one of the buckets is empty for the first time. The number should be no more than . Each of the following lines contains two integers and (), which means you pour from bucket into bucket in a process of pouring. You should guarantee that one of buckets is empty for the first time after the pouring. If there are several ways to empty one of the buckets, then print one of them.
1 2 3
2
3 2
3 1
1 4 6
3
2 1
3 1
1 3