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 conan614 at 2009-10-22 21:25:36 on Problem 1003
#include <iostream>
using namespace std;
int main()
{
	float number=0.00;
	float cards[1000];
	int i=0;
	int j=0;
	while(cin>>cards[i])
	{
		if(cards[i]==0.00)
			break;
		i++;

	}
	int count=i;
	i=0;
	for(i;i<count;i++)
	{
		while(number<cards[i])
		{		
			j++;
			number+=(float)1/(1+j);
		}
		cout<<j<<" "<<"card(s)"<<endl;
		j=0;
		number=0.00;
	}
	
	return 1;
}

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