[ABC266E] Throwing the Die 题解
解法
设
很显然,第
这样,我们就很容易推出:
实现
递推或递归实现即可。
放代码:
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
int n; double c=0; cin>>n;
for(int i=1;i<=n;i++){
double c0=0;
for(int j=1;j<=6;j++)c0+=max(c,1.0*j);
c=c0/6;
}
cout<<fixed<<setprecision(9)<<c<<endl;
return 0;
}