dp[0]=0;
// rep(i,1,n) dp[i]=(double)(n-i)/n*dp[i-1]+1+(double)(i)/n*dp[i];
// (n-i)/n dp[i]= n-i / n * dp[i-1] +1 => dp[i]=dp[i-1]+n/n-i
rep(i,1,n-1) dp[i]=dp[i-1]+(double)n/(n-i);
ans为dp[n-1]+1
标签:ble code markdown ice span gpo class post source
dp[0]=0;
// rep(i,1,n) dp[i]=(double)(n-i)/n*dp[i-1]+1+(double)(i)/n*dp[i];
// (n-i)/n dp[i]= n-i / n * dp[i-1] +1 => dp[i]=dp[i-1]+n/n-i
rep(i,1,n-1) dp[i]=dp[i-1]+(double)n/(n-i);
ans为dp[n-1]+1
标签:ble code markdown ice span gpo class post source
原文地址:https://www.cnblogs.com/caturra/p/8528965.html