409216: GYM103462 H Hsueh- And Treasure

Memory Limit:256 MB Time Limit:5 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

H. Hsueh- And Treasuretime limit per test5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Hsueh- Dreaming one night, dreaming that he was in a vast ocean.

In a faraway place, there is an island. It is said that there are some precious treasures on it. There are treasures left by the King of Sailing Kwords to give to the world.

So Hsueh- wants to find the treasure left by Kwords。

We assume that the sea is a two-dimensional plane, Hsueh- is currently at $$$(0,0)$$$, and the location of the treasure is at $$$(x,y)$$$.

Next, due to the influence of the cosmic background radiation wave, Hsueh- can only take exactly $$$i$$$ steps at the $$$i$$$-th moment, and each step can only walk one square in four directions, up, down, left, and right. The initial moment is $$$0$$$.

Hsueh- is too anxious to find the last treasure, so he asks you, can you help him plan the shortest route to the destination $$$(x,y)$$$. And please output this route.

Note that there may be multiple routes, and you can output any route.

Input

The first line contains a single integer $$$T(1 \leq T \leq 10)$$$, denoting the number of test cases.

For next $$$T$$$ lines, each line contains two integers $$$x, y(|x|, |y| \leq 10^9)$$$, representing the location of the treasure.

Output

For each test case,the output format must meet the following requirements.

The first line you need to print "Case #i:"(without quotation marks), representing the current number of test cases.

The second line you need to print a single integer $$$t$$$, which indicates the final moment at which it can reach $$$(x_i, y_i)$$$.

Next $$$t$$$ lines, each line contains two integers separated by a space, denoting the location of the $$$j$$$-th moment.

ExampleInput
2
1 0
2 2
Output
Case #1:
1
1 0
Case #2:
3
1 0
1 2
2 2

加入题单

算法标签: