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:小弟菜鸟一个哪位大哥帮看看哪错了!!!!!

Posted by szr508 at 2010-10-26 15:06:02 on Problem 1003
In Reply To:小弟菜鸟一个哪位大哥帮看看哪错了!!!!! Posted by:baohan45 at 2010-01-23 16:06:22
> 不胜感激
> #include<stdio.h>
> int main()
> {
>     float b,sum=0;
>     int n,a[1000],i=0;
> 	n=2;
> 	for(i=0;i<1000;i++)
> 		a[i]=0;
> 	i=0;
> 	while(scanf("%f",&b)!=EOF&&b!=0.00)
> 	{
> 			if(b<=0.2)
> 			{
> 				a[i]=1;
> 				i++;
> 			}
> 
> 		else{
> 			while(sum<b)
> 			{
> 				sum+=(1.00/n);
> 				n++;
> 			}
> 			a[i]=n-2;
> 			i++;
> 		}
> 	}
> 	for(i=0;i<1000;i++)
> 	{
> 		if(a[i]!=0)
> 			printf("%d card(s)\n",a[i]);
> 		else break;
> 	}
> 	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