khoqua

mail@pastecode.io avatar
unknown
abc
2 years ago
490 B
4
Indexable
Never
#include<iostream> 
#include<iomanip>  
#include<cmath>   

/*
  s = 1 + 1/(1+2) + 1/ (1+2+3) + ... + 1 / (1+2+...+n)
*/
using namespace std; 

double getSum(double t){ 
	double resum;
	resum = 2*(1-(1/(t+1))); 
	return resum;                       
}

int main(){ 
	double t, n[100000]; 
	cin >> t;   
	
	for(int i = 1; i <= t; i++){ 
		cin >> n[i];
	}  
	for(int i = 1; i <= t; i++){ 
		cout << setprecision(8) << fixed << getSum(n[i]) << endl;
	} 
return 0;
}