water~5

poj1003 http://poj.org/problem?id=1003
super water~
#include <iostream>
using namespace std;

void waterit(double a)
{
	int i=0;
	double s=0.0;
	while(s<a)
	{	
	
		s=s+1.0/((double)i+2.0);
		i++;
	}
	cout<<i<<" card(s)"<<endl;
}

int main()
{
	double a;
	while(1)
	{
		cin>>a;
		if(a<0.0001)
			break;
		waterit(a);
	}
	return 0;
}

你可能感兴趣的:(water)