| 
 | ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
| Re:庆祝,一次性AC,0MS,哈哈,贴下代码In Reply To:庆祝,一次性AC,0MS,哈哈,贴下代码 Posted by:denganliang at 2011-03-13 16:42:33 > 这道题目呵呵,我一次性就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: | 
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator