| ||||||||||
| 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 | |||||||||
高手麻烦看下,为什么不过阿~~~~
#include <iostream>
using namespace std;
int main()
{
int n;
double sum=0;
double i=1.0;
cout<<"Cards Overhang"<<endl;
while( scanf("%d",&n)!=EOF && n>=0 && n<=99999 )
{
while(i<=n)
{
sum=sum+1/(2.0*i);
i++;
}
printf("%5d %.3f\n",n,sum);
i=1.0;
sum=0;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator