CF625A.Guest From the Past
普及+/提高
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Kolya Gerasimov loves kefir very much. He lives in year 1984 and knows all the details of buying this delicious drink. One day, as you probably know, he found himself in year 2084, and buying kefir there is much more complicated.
Kolya is hungry, so he went to the nearest milk shop. In 2084 you may buy kefir in a plastic liter bottle, that costs a rubles, or in glass liter bottle, that costs b rubles. Also, you may return empty glass bottle and get c (c < b) rubles back, but you cannot return plastic bottles.
Kolya has n rubles and he is really hungry, so he wants to drink as much kefir as possible. There were no plastic bottles in his 1984, so Kolya doesn't know how to act optimally and asks for your help.
科里亚·格拉西莫夫非常喜欢开菲尔酸奶。他生活在1984年,对购买这种美味饮品的全部细节都了如指掌。有一天,正如你可能知道的那样,他发现自己来到了2084年,而在此时购买开菲尔酸奶要复杂得多。
科里亚饿了,于是前往最近的一家牛奶店。在2084年,你可以用塑料升装瓶购买开菲尔酸奶,价格为 a 卢布;也可以用玻璃升装瓶购买,价格为 b 卢布。此外,你还可以退回空的玻璃瓶并获得 c(其中 c<b)卢布的退款,但塑料瓶不可退回。
科里亚有 n 卢布,而且他非常饥饿,因此希望尽可能多地喝到开菲尔酸奶。在他生活的1984年还没有塑料瓶,因此科里亚不知道如何做出最优决策,便向你求助。
输入格式
First line of the input contains a single integer n (1 ≤ n ≤ 1018) — the number of rubles Kolya has at the beginning.
Then follow three lines containing integers a, b and c (1 ≤ a ≤ 1018, 1 ≤ c < b ≤ 1018) — the cost of one plastic liter bottle, the cost of one glass liter bottle and the money one can get back by returning an empty glass bottle, respectively.
输入的第一行包含一个整数 n(1 ≤ n ≤ 1018)—— 表示 Kolya 初始拥有的卢布数量。
接下来三行分别包含整数 a、b 和 c(1 ≤ a ≤ 1018,1 ≤ c < b ≤ 1018)—— 分别表示一个塑料一升瓶的价格、一个玻璃一升瓶的价格,以及退回一个空玻璃瓶所能获得的钱数。
输出格式
Print the only integer — maximum number of liters of kefir, that Kolya can drink.
输出唯一的整数——Kolya 能喝到的开菲尔乳酒的最大升数。
输入输出样例
输入#1
10 11 9 8
输出#1
2
输入#2
10 5 6 1
输出#2
2
说明/提示
In the first sample, Kolya can buy one glass bottle, then return it and buy one more glass bottle. Thus he will drink 2 liters of kefir.
In the second sample, Kolya can buy two plastic bottle and get two liters of kefir, or he can buy one liter glass bottle, then return it and buy one plastic bottle. In both cases he will drink two liters of kefir.
在第一个样例中,科里亚可以购买一个玻璃瓶,然后将其退回并再购买一个玻璃瓶。这样他将喝掉 2 升克菲尔乳。
在第二个样例中,科里亚可以购买两个塑料瓶,从而获得 2 升克菲尔乳;或者他可以先购买一个 1 升的玻璃瓶,然后将其退回,再购买一个塑料瓶。在这两种情况下,他都将喝掉 2 升克菲尔乳。
输入解题思路,AI测评打分。不知道怎么写?