504. Guessing Game
0
Medium
Alice and Bob are playing a game called Guessing Game. The rules of the game are as follows:
Alice selects a number between 1 and n.
Bob tries to guess the number.
If Bob guesses the correct number, he wins the game.
If Bob guesses the wrong number, Alice will inform him if the number she picked is higher or lower, and Bob will continue guessing.
Every time Bob guesses a wrong number x, he has to pay x dollars. If Bob runs out of money, he loses the game.
Given a specific value of n, determine the minimum amount of money Bob needs to ensure a win regardless of Alice's chosen number.
Given a specific value of n, determine the minimum amount of money Bob needs to ensure a win regardless of Alice's chosen number.
Input Format
The first and only line of input contains an integer n.
Output Format
Return the minimum amount of money Bob needs to guarantee a win regardless of Alice's chosen number.
Example
Input
10
Output
16
Constraints
1 <= n <= 200
Loading...
View Submissions
Console