ZOJ Problem Set - 1045 HangOver

#include <stdio.h>

int main()
{
	float c;
	int i;
	while(scanf("%f",&c)!=EOF&&c)
	{
		float sum=0;
		for(i=2;sum<c;i++)
		{
			sum+=(1.0/i);
		}
		printf("%d card(s)\n",i-2);
	}
		
	return 0;
}

  简单不多说了

posted @ 2013-09-04 10:55  xlturing  阅读(208)  评论(0编辑  收藏  举报