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 cyuyanlover at 2012-07-01 14:47:25 on Problem 1003
#include<stdio.h>
void main()
{
	double a;
	int i,n;
	while(1)
	{
		scanf("%lf",&a);
		if(a==0)
			break;
		for(n=1;;n++)
		{
			double sum=0;
			for(i=1;i<=n;i++)
				sum+=1.0/(i+1);
			if(sum>=a)
				break;
		}
		printf("%d card(s)\n",n);
	}
}

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