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

庆祝,一次性AC,0MS,哈哈,贴下代码

Posted by denganliang at 2011-03-13 16:42:33 on Problem 1003
这道题目呵呵,我一次性就AC了,贴下代码

#include <stdio.h>
int main()
{
	float a,sum=0.0;
	int count=2,flag=0;
	while(scanf("%f",&a),a!=0.0)
    {
		if(flag==1)
		   printf("\n");
		if(flag==0)
		  flag=1;
		
		count=1;
		sum=0;
		while(sum+=(1.0/(count+1)))
		{
			if(sum<a)
		 count++;
		 else break;
		 
		 }
		 printf("%d card(s)",count);
		}
	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