正题
题目大意
开始暴击率为
x
x
x,每次失败后都会增加
x
x
x,成功后重置,然后求攻击
1
0
1
0
6
10^{10^6}
10106次后的暴击次数除以
1
0
1
0
6
10^{10^6}
10106
解题思路
定义
a
n
s
ans
ans为期望攻击多少次后暴击,然后答案为
1
a
n
s
\frac{1}{ans}
ans1。然后
a
n
s
ans
ans可以枚举多少次暴击计算即可。
c
o
d
e
code
code
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std
;
double x
,ans
;
int main()
{
scanf("%lf",&x
);
double q
=1,i
;
for(i
=1;i
<=100/x
;i
++){
ans
=ans
+i
*i
*x
*q
*0.01;
q
*=(100-i
*x
)*0.01;
}
ans
+=i
*q
;
printf("%.10lf",1.0/ans
);
}