show my code to help you understand it
#include<iostream> #include<cmath> using namespace std; int main() { int n; cin>>n; while(n--) { double p; cin>>p; double result=(2*p-p*p)/(1-p)+(1-p*p)/p; //cout<<result<<endl; cout<<round(result)<<endl; } }