Peter Pan of Chocolates
Time: 2 s
Memory: 125 MB
Memory: 125 MB
You have \(n\) chocolates. You can perform the following operation each day as long as you have at least one chocolate:
- Choose any \(p\) people from an infinite number of people \((1 \leq p \leq \text{current amount of chocolates})\).
- While you have at least p chocolates:
- Give exactly one chocolate to each of \(p\) person.
- Move to the next day with the remaining chocolates.
Input
The first line contains a single integer \(t\) \((1 \leq t \leq 10^5)\) — the number of test cases.The first line of each test case contains a single integers \(n\) \((1 \leq n \leq 10^{18})\) — described in the statement.
Output
For each test case, print a single integer — described in the statement.
Examples
| Input | Output |
|---|---|
|
3
5 18 40 |
2
4 5 |
Notes
In the first testcase, choosing \(p = 1\) will not produce optimal answer because you will provide all chocolates in the first day alone. The first day: \(p = 3\) and the second day \(p = 2\), will produce the optimal number of days which is \(2\).
Problem Info
| Problem ID | 274 |
| Time Limit | 2000 ms |
| Memory Limit | 128000 KB |
| Moderators | amirhozaifa , fahimcp495 |
Statistics
Submit
You need to Login or Registration for submit your solution