Codeforces Round 952 (Div. 4) |
---|
Finished |
Given an integer $$$n$$$, find an integer $$$x$$$ such that:
The first line contains $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases.
Each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 100$$$).
For each test case, output an integer, the optimal value of $$$x$$$. It can be shown there is only one unique answer.
2315
3 2
For $$$n = 3$$$, the possible values of $$$x$$$ are $$$2$$$ and $$$3$$$. The sum of all multiples of $$$2$$$ less than or equal to $$$n$$$ is just $$$2$$$, and the sum of all multiples of $$$3$$$ less than or equal to $$$n$$$ is $$$3$$$. Therefore, $$$3$$$ is the optimal value of $$$x$$$.
For $$$n = 15$$$, the optimal value of $$$x$$$ is $$$2$$$. The sum of all multiples of $$$2$$$ less than or equal to $$$n$$$ is $$$2 + 4 + 6 + 8 + 10 + 12 + 14 = 56$$$, which can be proven to be the maximal over all other possible values of $$$x$$$.
Name |
---|