#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int n,st,en;
int main(){
ios::sync_with_stdio(0);
int t;
cin>>t;
while(t--){
int n;
cin>>n;
cout<<fixed<<setprecision(3);
if(n==1)
cout<<0.0<<endl;
else{
int side=4*(n-1);
int mid=n*n-side;
double ans=side+mid*sqrt(2);
cout<<ans<<endl;
}
if(t)
cout<<endl;
}
}
#include <iomanip>
#include <cmath>
using namespace std;
int n,st,en;
int main(){
ios::sync_with_stdio(0);
int t;
cin>>t;
while(t--){
int n;
cin>>n;
cout<<fixed<<setprecision(3);
if(n==1)
cout<<0.0<<endl;
else{
int side=4*(n-1);
int mid=n*n-side;
double ans=side+mid*sqrt(2);
cout<<ans<<endl;
}
if(t)
cout<<endl;
}
}
Comments
Post a Comment