|
|||
FarmerYim has always wanted to be a farmer. After his computer engineering graduation, he went straight back to his home and prepared to do a hydroponic farm. However, he has a problem. The plants he is growing are of different size, but they are all square-shaped, for example 1 × 1, 2 × 2, or 3 × 3. The greenhouse he is using for the plants is shaped like a rectangle. Write a program to find the total number of squares of each size that can be fitted in the greenhouse, as well as the total area of all these squares. Input SpecificationThe first line of the input contains n (0 < n ≤ 100), the number of test cases. Then n lines follow, each containing one test case. Each test case has two integers: w (0 < w ≤ 1000) and h (0 < h ≤ 1000), separated by a space, describing the width and height of the greenhouse. Output SpecificationFor each test case, output in a line two numbers separated by a space. The first number is the total number of squares of each size that can be fitted in the greenhouse, and the second number is the total area of all these squares. Sample Input
Output for Sample Input
|
|||
University of Debrecen; Faculty of Informatics; v. 09/30/2024 |