Loading...
Peter Pan of Chocolates
Time: 2 s
Memory: 125 MB
You have \(n\) chocolates. You can perform the following operation each day as long as you have at least one chocolate:
  1. Choose any \(p\) people from an infinite number of people \((1 \leq p \leq \text{current amount of chocolates})\).
  2. While you have at least p chocolates:
    • Give exactly one chocolate to each of \(p\) person.
  3. Move to the next day with the remaining chocolates.
It is not necessary to select the same \(p\) each day. Your task is to determine the maximum number of days you can perform the above operation.
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