| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
看懂题意就会做了,贡献c++代码一份#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
int n;
cout<<"Cards Overhang"<<endl;
while(cin>>n)
{
int i;
double sum=0.0;
for( i=1;i<n+1;i++)
{
sum+=1.0/(2*i);
}
cout<<setiosflags(ios::right)<<setw(5)<<n;
cout<<setiosflags(ios::fixed)<<setw(10)<<setprecision(3)<<sum<<endl;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator