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 o87481299 at 2011-07-05 10:35:45 on Problem 1003
#include <iostream>
using namespace std;
int f(double num )
{
	double i,sum=0;
	for( i=2;sum<num;i+=1){
		sum+=1/i;
	}
	
	return (int)i-2;	
}


int main()
{
	double num=1;
	while(num!=0.0){
		cin>>num;
		cout<<f(num)<<" card(s)"<<endl;
	}	
	
	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