Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

那位大虾帮忙看看,那出错了,谢谢

Posted by Galasxy at 2010-09-22 11:29:04 on Problem 1003
In Reply To:小弟菜鸟一个哪位大哥帮看看哪错了!!!!! Posted by:baohan45 at 2010-01-23 16:06:22
#include <iostream>
using namespace std;
float Hangover(int n)
{
	int i;
	float m=0.00;
	for(i=1;i<=n;i++)
		m+=1.0/(i+1);
	return m;
}
int main()
{
    float c;
    while(cin>>c)
    {
		if(c==0.00)
			break;
		else
		{
			if(c>=0.01&&c<0.50)
			{
				cout<<"1 card(s)"<<endl;
				break;
			}
			else
				for(int i=1;i<=273;i++)
					if(Hangover(i)>=c)
					{
						cout<<i<<" card(s)"<<endl;
						break;
					}
		}
    }
	return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator