Boundary
시간 제한2초메모리 제한2048 MB
가로 w, 세로 l인 직사각형에서 두께 1인 테두리만 1 x a 타일로 채울 수 있는 모든 a를 오름차순으로 구한다.
문제
Bethany would like to tile her bathroom. The bathroom has width centimeters and length centimeters. If Bethany simply used the basic tiles of size centimeters, she would use of them.
However, she has something different in mind.
- On the interior of the floor she wants to use the tiles. She needs exactly of these.
- On the floor boundary she wants to use tiles of size for some positive integer . The tiles can also be rotated by degrees.
For which values of can Bethany tile the bathroom floor as described? Note that can also be .
입력
Each test contains multiple test cases. The first line contains an integer () — the number of test cases. The descriptions of the test cases follow.
Each test case consist of a single line, which contains two integers , () — the dimensions of the bathroom.
출력
For each test case, print an integer () — the number of valid values of for the given test case — followed by integers , , , () — the valid values of . The values , , , have to be sorted from smallest to largest.
It is guaranteed that under the problem constraints, the output contains at most integers.