305213: CF991C. Candies

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Candies

题意翻译

Vasya有$n$个糖果,在开始的时候 Vasya 选择了一个整数$k$,表示他每天会吃$k$个糖果,Petya想~~偷~~吃一部分糖果,他每天会吃当前数量的$10\%$(下取整)的糖果 输出最小的$k$,使得Vasya至少吃掉一半的糖果 注意: 若Vasya吃糖果时数量不满$k$,则Vasya会全吃掉。 若Petya吃糖果时数量不满$10$个,则Petya不会吃糖果 感谢@attack 提供翻译

题目描述

After passing a test, Vasya got himself a box of $ n $ candies. He decided to eat an equal amount of candies each morning until there are no more candies. However, Petya also noticed the box and decided to get some candies for himself. This means the process of eating candies is the following: in the beginning Vasya chooses a single integer $ k $ , same for all days. After that, in the morning he eats $ k $ candies from the box (if there are less than $ k $ candies in the box, he eats them all), then in the evening Petya eats $ 10\% $ of the candies remaining in the box. If there are still candies left in the box, the process repeats — next day Vasya eats $ k $ candies again, and Petya — $ 10\% $ of the candies left in a box, and so on. If the amount of candies in the box is not divisible by $ 10 $ , Petya rounds the amount he takes from the box down. For example, if there were $ 97 $ candies in the box, Petya would eat only $ 9 $ of them. In particular, if there are less than $ 10 $ candies in a box, Petya won't eat any at all. Your task is to find out the minimal amount of $ k $ that can be chosen by Vasya so that he would eat at least half of the $ n $ candies he initially got. Note that the number $ k $ must be integer.

输入输出格式

输入格式


The first line contains a single integer $ n $ ( $ 1 \leq n \leq 10^{18} $ ) — the initial amount of candies in the box.

输出格式


Output a single integer — the minimal amount of $ k $ that would allow Vasya to eat at least half of candies he got.

输入输出样例

输入样例 #1

68

输出样例 #1

3

说明

In the sample, the amount of candies, with $ k=3 $ , would change in the following way (Vasya eats first): $ 68 \to 65 \to 59 \to 56 \to 51 \to 48 \to 44 \to 41 \\ \to 37 \to 34 \to 31 \to 28 \to 26 \to 23 \to 21 \to 18 \to 17 \to 14 \\ \to 13 \to 10 \to 9 \to 6 \to 6 \to 3 \to 3 \to 0 $ . In total, Vasya would eat $ 39 $ candies, while Petya — $ 29 $ .

Input

题意翻译

Vasya有$n$个糖果,在开始的时候 Vasya 选择了一个整数$k$,表示他每天会吃$k$个糖果,Petya想~~偷~~吃一部分糖果,他每天会吃当前数量的$10\%$(下取整)的糖果 输出最小的$k$,使得Vasya至少吃掉一半的糖果 注意: 若Vasya吃糖果时数量不满$k$,则Vasya会全吃掉。 若Petya吃糖果时数量不满$10$个,则Petya不会吃糖果 感谢@attack 提供翻译

加入题单

上一题 下一题 算法标签: