小玉开心的在游泳,可是她很快难过的发现,自己的力气不够,游泳好累哦。已知小玉第一步能游2米,可是随着越来越累,力气越来越小,她接下来的每一步都只能游出上一步距离的98%。现在小玉想知道,如果要游到距离x米的地方,她需要游多少步呢。请你编程解决这个问题。
输入格式:
输入一个数字(不一定是整数,小于100m),表示要游的目标距离。
输出格式:
输出一个整数,表示小玉一共需要游多少步。
输入样例#1:
4.3
输出样例#1:
3
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define lli long long int
using namespace std;
void read(int &n)
{
char c='+';int x=0;bool flag=0;
while(c<'0'||c>'9')
{c=getchar();if(c=='-')flag=1;}
while(c>='0'&&c<='9')
x=x*10+(c-48),c=getchar();
flag==1?n=-x:n=x;
}
int a[10];
double will;
double now=0;
double base=2;
int step;
int main()
{
cin>>will;
while(now<will)
{
step++;
now+=base;
base*=0.98;
}
printf("%d",step);
return 0;
}