PROBLEM 21: Maximum GCD
Problem Reference : Codeforces
Let's consider all integers in the range from to (inclusive).
Among all pairs of distinct integers in this range, find the maximum possible greatest common divisor of integers in pair. Formally, find the maximum value of , where .
The greatest common divisor, , of two positive integers and is the biggest integer that is a divisor of both and .
The first line contains a single integer () — the number of test cases. The description of the test cases follows.
The only line of each test case contains a single integer ().
For each test case, output the maximum value of among all .
Solution:
- t = int(input())
- i = 0
- while i < t:
- n = int(input())
- n1 = n // 2
- print(n1)
- i += 1
2 3 5
1 2
No comments:
Post a Comment