/// Raihan Ruhin /// CSE, Jahangirnagar University. /// Dhaka-Bangladesh. /// id: raihanruhin (topcoder / codeforces / codechef / uva / uvalive / spoj), 3235 (lightoj) /// mail: raihanruhin@ (yahoo / gmail / facebook) /// blog: ruhinraihan.blogspot.com #include<bits/stdc++.h> using namespace std; #define SET(a) memset(a,-1,sizeof(a)) #define CLR(a) memset(a,0,sizeof(a)) #define PI acos(-1.0) #define MOD 1000000007 #define MX 100010 int main() { ios_base::sync_with_stdio(0);cin.tie(0); int tc, kk=1, n; string s; char ch; double denominator = 1, sum=0.0; cout<<"n e\n"; cout<<"- -----------\n"; for(int i=0;i<10;i++) { if(i>1) denominator*=(double)i; sum+=1.0/denominator; cout<<i<<" "<<setprecision(9)<<fixed<<sum<<"\n"; //cout<<i<<" "<<sum<<"\n"; } return 0; }
Wednesday, 9 September 2015
u Calculate e (UVALive 2083, HDU 1012, ZOJ 1113, POJ 1517, Regionals 2000 >> North America - Greater NY)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment