标签:
1 #include <cstdio> 2 int main() 3 { 4 int n; 5 while(scanf("%d",&n)&&n!=0){ 6 double sum; 7 if(n!=1){ 8 sum=n*1.00+2.00/n; 9 for(int i=2;i<n;i++){ 10 sum+=i*2*1.00/(n-1*i+1); 11 } 12 }else{ 13 sum=1.00; 14 } 15 16 printf("%.2lf\n",sum); 17 } 18 19 return 0; 20 }
标签:
原文地址:http://www.cnblogs.com/xzt6/p/5777880.html