2421 - I2P(I)2021_Yang_lab6 Scoreboard

Time

2021/11/09 18:30:00 2021/11/09 20:30:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
11710 GCD(recursive)
13305 Count the wood Ⅱ

11710 - GCD(recursive)   

Description

Given two positive integers a and b, compute the greatest common divisor (GCD) of a and b. The GCD of a and b is the biggest integer that can divide a and b with no reminder.

Hint:
To compute gcd(48,18), divide 48 by 18 to get a quotient of 2 and a remainder of 12. Then divide 18 by 12 to get a quotient of 1 and a remainder of 6. Then divide 12 by 6 to get a remainder of 0, which means that 6 is the gcd

Input

First line contains a positive integer t (t<=10000), which indicates the number of test cases in the input. In the next t lines, each line contains two positive integers a, b, which are smaller than or equal to 10^6.

Output

For each case, output the GCD of a and b in a line.

Sample Input  Download

Sample Output  Download

Tags




Discuss




13305 - Count the wood Ⅱ   

Description

The floor in Winnie the Pooh’s house is made of N row *M column square woods,

When he cleaned the house, he observed that there are two types of wood — 'o' and '#' .

He wants to know the maximum number of consecutive woods with the same type in a row or column or diagonal of each type respectively.

Input

The first line you are given an integer T, means there will be T tests.(1<=T<=10).

Each test you are given integers N, M.

The next lines contains characters('o' or '#').

Note:

Testcase 1: (1 ≤ NM , K≤ 1000) and the diagonal does not affect the answer.

Testcases 2~3: (1 ≤ NM , K≤ 100).

Testcases 4~5: (1 ≤ NM , K≤ 1000).

Output

Each test output the maximun number of consecutive  'o'  woods, the maximun number of consecutive  '#'  woods, and a new line.

Sample Input  Download

Sample Output  Download

Tags

按下電源建 離開八



Discuss