其他分享
首页 > 其他分享> > P1984 [SDOI2008]烧水问题

P1984 [SDOI2008]烧水问题

作者:互联网

 1 #include <iostream>
 2 #include<iomanip>
 3 using namespace std;
 4 double t[50010];
 5 
 6 int main()
 7 {
 8     int n;
 9     double sum = 0;
10     double pro;
11     cin >> n;
12     pro = (double)420000 / n;
13     for (int i = 1; i <= n; i++)
14     {
15         sum += pro;
16         pro *= (1 - 1.0 / (2 * i));
17     }
18     cout << setprecision(2) << fixed << sum;
19 }
View Code

 

标签:烧水,int,double,pro,namespace,include,P1984,SDOI2008,sum
来源: https://www.cnblogs.com/thjkhdf12/p/11672807.html