UVA-11384
Help are needed for Dexter
Time Limit: 3000MS |
Memory Limit: Unknown |
64bit IO Format: %lld &%llu |
Submit Status
Description
Problem H
Help are needed for Dexter
Time Limit:3 Second
Dexter is tired of Dee Dee. So he decided to keep Dee Dee busy in a game. The game he planned for she's quite easy-to-play but isn't easy-to-win at least don't for Dee Dee. But Dexter does not has time to spend on this silly task, so he wants your help.
There would be a button and when it would be pushed a random number N would be chosen by computer. Then on screen there'll be numbers from 1 to N. Dee Dee can choose any number of numbers from the numbers on the screen, And then she'll command computer to subtract a positive number chosen by hers (not necessarily on screens) from the Selec Ted numbers. Her objective'll be and make all the numbers 0.
For example if N = 3, then on screen there'll be 3 numbers on Screen:1, 2, 3. Say She now selects 1 and 2. Commands to subtract 1, then the numbers on the screen would be:0, 1, 3. Then she selects 1 and 3 and Commands to subtract 1. Now the numbers is 0, 0, 2. Now she subtracts 2 from 2 and all the numbers become 0.
Dexter is isn't so dumb to understand the This can be do very easily, so-make a twist he'll give a limit L for each N and surely L'll be as minimum as possible so it's still possible to win within L moves. But Dexter does not has time to think how to determine L for each n, so he asks you to write a code which would take N as Input and give L as output.
Input and Output:
Input consists of several lines each with N such that 1≤n≤1,000,000,000. Input would be terminated by end of file. For each N output L in separate lines.
SAMPLE INPUT |
OUTPUT for SAMPLE INPUT |
1 2 3 |
1 2 2 |
Problemsetter: Md. Mahbubul Hasan
Source
Root:: Prominent problemsetters:: Md. Mahbubul Hasan
Root:: AOAPC i:beginning Algorithm Contests--Training Guide (Rujia Liu):: Chapter 1. Algorithm Design:: General Problem Solving Techniques:: Examples
Root:: Competitive programming 3:the New Lower Bound of programming contests (Steven & Felix Halim):: Mathematics: : Ad Hoc Mathematics problems:: Logarithm, exponentiation, Power
Before the end of the final water,, the recent may be due to review the suspension of AC tour
Idea: Find the law, f [n] = f [N/2] + 1;
AC Code:
Uva-11384-help is needed for Dexter (law!! )