Please check my code why is it giving WA , even tho it is correct for sample testcases

```
#include<bits/stdc++.h>
#include <cmath>
using namespace std;
#define ar array
#define ll long long
const int MAX_N = 1e5 + 1;
const ll MOD = 1e9 + 7;
const ll INF = 1e9;
void solve() {
ll int n,m,x,y,cnt=0,temp,sum=0,i,j,k,l,maxi=0,mini=INF;
double r,ans;
string str;
cin>>n;
double theta = 180/n;
double extra_parts,total_area,c,d;
theta = theta*3.141592653/180;
extra_parts= (sin(2*theta) * n)/(double)8;
total_area= (((cos(theta)/(sin(theta)))*n))/4;
c= total_area-extra_parts;
r= 1-(double)(c/total_area);;
// ans = r (1/r + (1-r)/r^2)
ans = 1+ (1-r)/r;
cout << fixed << setprecision(6) << ans<<endl;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int tc = 1;
cin >> tc;
for (int t = 1; t <= tc; t++) {
// cout << "Case #" << t << ": ";
solve();
}
}
```