301046: CF198A. About Bacteria

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

Description

About Bacteria

题意翻译

## 题目描述 游侠 $Qwerty$ 接受了一项政府的工作并来到了火星。他需 要呆在神奇实验室里做一些关于细菌的实验,这些实验十分有趣和不寻常。这项工作不难,却又很高的报酬。 第一次实验中,试管里只有1个细菌,每秒钟每个细菌会分裂成 $k$ 个,同时通过一些不寻常的变化,还会再多出 $b$ 个细菌。也就是说,一开始试管中有 $x$ 个细菌,那么一秒后试管中就会有 $kx+b$ 个细菌。 第一次实验中发现,当一开始在试管中放入1个细菌时,经过 $n$ 秒之后,刚刚好有 $z$ 个细菌 第二次实验,游侠 $Qwerty$ 会对试管消毒(也就是说没有细菌了),然后他再把 $t$ 个细菌放进去。在没有开始实验前,他突然想知道:按照第一次实验中的分裂模式,他至少需要多少秒钟才能够让试管中有 $z$ 个细菌呢? 帮助 $Qwerty$ 找出这个最小秒数吧! ## 输入格式 一行,输入题目中的 $k$ , $b$ , $n$ 和 $t$ $(1<=k,b,n,t<=10^6)$ ## 输出格式 输出第二次实验中最少经过多少秒才能使试管中有 $z$ 个细菌 感谢@Uni_Tune 提供的翻译

题目描述

Qwerty the Ranger took up a government job and arrived on planet Mars. He should stay in the secret lab and conduct some experiments on bacteria that have funny and abnormal properties. The job isn't difficult, but the salary is high. At the beginning of the first experiment there is a single bacterium in the test tube. Every second each bacterium in the test tube divides itself into $ k $ bacteria. After that some abnormal effects create $ b $ more bacteria in the test tube. Thus, if at the beginning of some second the test tube had $ x $ bacteria, then at the end of the second it will have $ kx+b $ bacteria. The experiment showed that after $ n $ seconds there were exactly $ z $ bacteria and the experiment ended at this point. For the second experiment Qwerty is going to sterilize the test tube and put there $ t $ bacteria. He hasn't started the experiment yet but he already wonders, how many seconds he will need to grow at least $ z $ bacteria. The ranger thinks that the bacteria will divide by the same rule as in the first experiment. Help Qwerty and find the minimum number of seconds needed to get a tube with at least $ z $ bacteria in the second experiment.

输入输出格式

输入格式


The first line contains four space-separated integers $ k $ , $ b $ , $ n $ and $ t $ $ (1<=k,b,n,t<=10^{6}) $ — the parameters of bacterial growth, the time Qwerty needed to grow $ z $ bacteria in the first experiment and the initial number of bacteria in the second experiment, correspondingly.

输出格式


Print a single number — the minimum number of seconds Qwerty needs to grow at least $ z $ bacteria in the tube.

输入输出样例

输入样例 #1

3 1 3 5

输出样例 #1

2

输入样例 #2

1 4 4 7

输出样例 #2

3

输入样例 #3

2 2 4 100

输出样例 #3

0

Input

题意翻译

## 题目描述 游侠 $Qwerty$ 接受了一项政府的工作并来到了火星。他需 要呆在神奇实验室里做一些关于细菌的实验,这些实验十分有趣和不寻常。这项工作不难,却又很高的报酬。 第一次实验中,试管里只有1个细菌,每秒钟每个细菌会分裂成 $k$ 个,同时通过一些不寻常的变化,还会再多出 $b$ 个细菌。也就是说,一开始试管中有 $x$ 个细菌,那么一秒后试管中就会有 $kx+b$ 个细菌。 第一次实验中发现,当一开始在试管中放入1个细菌时,经过 $n$ 秒之后,刚刚好有 $z$ 个细菌 第二次实验,游侠 $Qwerty$ 会对试管消毒(也就是说没有细菌了),然后他再把 $t$ 个细菌放进去。在没有开始实验前,他突然想知道:按照第一次实验中的分裂模式,他至少需要多少秒钟才能够让试管中有 $z$ 个细菌呢? 帮助 $Qwerty$ 找出这个最小秒数吧! ## 输入格式 一行,输入题目中的 $k$ , $b$ , $n$ 和 $t$ $(1<=k,b,n,t<=10^6)$ ## 输出格式 输出第二次实验中最少经过多少秒才能使试管中有 $z$ 个细菌 感谢@Uni_Tune 提供的翻译

加入题单

算法标签: