show my code to help you understand it
whutshiliu 2017-03-22 18:06:02
#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; } }