Problem G
Modeling Virus Growth
The AI Overlords have created a new type of virus and managed to install it on a node in one of our servers! We need to know how long we have before the infected server bank is fully taken over.
Given a server with n nodes, we need to know how quickly the virus will propagate and take over all the nodes. Once all nodes are infested, the server is lost. A virus has two states; its install state and its replication state. Once a virus is on a node it takes 1 minute to install, then it enters its replication state, where it infects a new node every minute. All viruses replicate onto new server nodes without any collisions. Viruses will not replicate onto nodes that are already infected with a virus in either state.
At minute $0$ the server starts with exactly $1$ infected node, which begins in the installation phase. At minute $1$ it enters the replication state, and at minute $2$ it replicates, resulting in $1$ virus in the installation state and $1$ in the replication state.
Input
The input consists of a single line, $n$, containing the number of nodes in the server bank, where $0 \leq n \leq 10^9$.
Output
Output the number of minutes it will take for every node in the server bank to be fully infected. A node is fully infected if it has a copy of the virus in the replication state on it.
Explanation of sample 1 and 2
The first sample should output $1$ since the only node in the server starts with the virus in the installation phase on it. After $1$ minute, the virus enters the replication phase, and the only node in the server is fully infected.
The second sample should output $3$. This is because the first node takes $1$ minute to enter the replication phase, at minute $2$ replicates onto the second node, and by minute three the virus on the second node has finished installing and is in the replication phase.
| Sample Input 1 | Sample Output 1 |
|---|---|
1 |
1 |
| Sample Input 2 | Sample Output 2 |
|---|---|
2 |
3 |
| Sample Input 3 | Sample Output 3 |
|---|---|
5 |
5 |
| Sample Input 4 | Sample Output 4 |
|---|---|
90 |
12 |
| Sample Input 5 | Sample Output 5 |
|---|---|
100625432 |
40 |