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

Re:靠~~没看见后面还要输出card(s),杯具的浪费了我的submission

Posted by pfa2008 at 2010-05-27 10:22:48 on Problem 1003
In Reply To:靠~~没看见后面还要输出card(s),杯具的浪费了我的submission Posted by:pfa2008 at 2010-05-27 10:21:54
#include <stdio.h>

int main()
{
	float c;
	float res;
	int cards;

	while(scanf("%f",&c)!=EOF)
	{
		if(c==0.00)
			break;

		cards=0;
		res=0;
		while((res+=1.0/float(++cards+1))<=c);

		printf("%d card(s)\n",cards);
	}
	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