아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Boundary

시간 제한2초메모리 제한2048 MB

요약
가로 w, 세로 l인 직사각형에서 두께 1인 테두리만 1 x a 타일로 채울 수 있는 모든 a를 오름차순으로 구한다.
난이도

보통10점 중 6점

유형
수학, 정수론, 구현
정답자
아직 제출이 없습니다

문제

Bethany would like to tile her bathroom. The bathroom has width ww centimeters and length ll centimeters. If Bethany simply used the basic tiles of size 1×11 × 1 centimeters, she would use w⋅lw · l of them.

However, she has something different in mind.

  • On the interior of the floor she wants to use the 1×11 × 1 tiles. She needs exactly (w−2)⋅(l−2)(w - 2) · (l - 2) of these.
  • On the floor boundary she wants to use tiles of size 1×a1 × a for some positive integer aa. The tiles can also be rotated by 9090 degrees.

For which values of aa can Bethany tile the bathroom floor as described? Note that aa can also be 11.

입력

Each test contains multiple test cases. The first line contains an integer tt (1≤t≤1001 ≤ t ≤ 100) — the number of test cases. The descriptions of the tt test cases follow.

Each test case consist of a single line, which contains two integers ww, ll (3≤w,l≤1093 ≤ w, l ≤ 10^9) — the dimensions of the bathroom.

출력

For each test case, print an integer kk (0≤k0 ≤ k) — the number of valid values of aa for the given test case — followed by kk integers a_1a\_1, a_2a\_2, …\dots, a_ka\_k (1≤a_i1 ≤ a\_i) — the valid values of aa. The values a_1a\_1, a_2a\_2, …\dots, a_ka\_k have to be sorted from smallest to largest.

It is guaranteed that under the problem constraints, the output contains at most 200,000200\\,000 integers.

예제1

  1. 예제 1

    입력
    3
    3 5
    12 12
    314159265 358979323
    
    예상 출력
    3 1 2 3
    3 1 2 11
    2 1 2