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

为什么是wrong answer

Posted by 306565318 at 2008-10-15 19:38:10 on Problem 1003
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
	cin>>setprecision(3);
	float number;
    while(cin>>fixed>>number)
	{
		float sum=0;
		if(number<0.01||number>5.20)
		{
			cout<<"input error"<<endl;
			cin>>fixed>>number;
		}
		if(number==0)
			return 0;
                float i;
		for(i=2;sum<number;i++)
		{
			sum+=(1/i);
		}
		cout<<i-2<<" card(s)"<<endl;
	}
	
}

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