| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 10236 | Lab06 |
|
| 11160 | GCD and LCM |
|
Description
Given a number N, we can create an N by N matrix as below:
1 2 3 4 5
16 17 18 19 6
15 24 25 20 7
14 23 22 21 8
13 12 11 10 9
In this case, N = 5, and the elements are in order from 1 to N2 as a clockwise spiral pattern.
Note that we always start from the upper left corner.
Now we have a sequence of numbers, please print the corresponding matrices.
Input
A sequence of numbers, each number N indicates the size of matrix. (1 <= N <= 20)
The input is terminated by a newline '\n'.
Output
The matrices corresponding to the input.
Use "%3d " to printf each element. Print a newline '\n' at the end of each row.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Given three positive integers x, y, and z, compute their greatest common divisor (GCD) and least common multiple (LCM).
Input
The first line contains a positive integer N, which indicates the number of test cases in each input.
In the next N lines, each line contains three positive integer x, y, z.
Level 1: x, y, z < 10
Level 2: x, y, z < 10^2
Level 3: x, y, z < 10^3
Level 4: x, y, z < 10^4
Output
For each test case, output the GCD and LCM of x, y, and z in a line.
Note that you have to add '\n' at the end of output.