题目描述
Problem Description
This year, the Rio de Janeiro Olympics will be held from August 5th.
The Summer Olympics are supposed to be held in years that are multiples of 4.
Also, the Ise-Shima Summit will be held on May 26th this year.
Summits held in Japan are in the years 2000, 2008, 2016, etc., which are multiples of 8 in recent years.
Anyway, this year has a "lot of divisors". It has as many as 36 divisors!
This is something that everyone in the world must be thinking. Because such a "year with many divisors" is rarely experienced.
Even as a second-year middle school student, I take this seriously.
So, I present to you the following problem:
"Find the integer between 1 and n (inclusive) with the most divisors, and the number of those divisors."
Let's solve this problem for future generations.
Input Format
The input is given from the standard input in the following format:
$ Q $ $ n_1 $ $ : $ $ n_Q $
- The first line contains the number of queries $ Q $.
- The next $ Q $ lines contain the integer $ n $ for each query.
- $ n_i $ represents $ n $ for the i-th query.
Output Format
The output should follow the standard output in the following format:
- Output the maximum number of divisors among the integers up to $ n $ and the smallest integer with that number of divisors, separated by a space.
- For example, when $ n=96 $, there are 5 numbers with 12 divisors: 60, 72, 84, 90, 96, but the smallest among them is 60.
- In this case, the output line would be $ "12 $ $ 60" $.
- Output for each query should be on a new line, resulting in $ Q $ lines of output.
Sample Input and Output
Sample Input #1
1
50
Sample Output #1
10 48
Sample Input #2
1
96
Sample Output #2
12 60
Sample Input #3
3
240
480
1200
Sample Output #3
20 240
24 360
32 840
Sample Input #4
2
2016
423
Sample Output #4
40 1680
24 360
Notes/Hints
Constraints
- $ 1≦n≦{10}^{17} $
- $ 1≦Q≦1,000 $
Subtasks
Subtask $ 1 $ \[ $ 8 $ points \]
- Satisfies $ 1≦n≦10,000 $.
- Satisfies $ Q≦100 $.
Subtask $ 2 $ \[ $ 34 $ points \]
- Satisfies $ 1≦n≦1,000,000,000 $.
- Satisfies $ Q≦100 $.
Subtask $ 3 $ \[ $ 58 $ points \]
- No additional constraints.
Sample Explanation 1
The divisors of $ 48 $ are {$ 1,2,3,4,6,8,12,16,24,48 $} which are 10 in total.
Sample Explanation 2
This is the same as the example in the problem statement.
Sample Explanation 3
$ 840 $ is the smallest number that is divisible by all numbers from 1 to 8. Also, note that the output should be newline-separated for each query.
Sample Explanation 4
$ 2016 $ has a lot of divisors, but it does not match the number of divisors of $ 1680 $. Also, today is April 23, 2016. By the way, $ 423 $ has 6 divisors.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分