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 00648245 at 2006-10-20 17:46:41 on Problem 1003
In Reply To:看一看吧,毛病在哪阿? Posted by:plich at 2006-10-15 14:37:32
> #include<stdio.h>
> int c(float len)
> {
> int n=1,k=0;
> float l=0;
> 
> for(;k==0;n++)
> 	{
> 		l+=(float)1/(n+1);
> 		if(l>=len)
> 			k=n;
> 	}
> return k;
> }
> int main()
> {
> float m[50];
> m[0]=1.0;
> int i=1,n;
> 
> for(;m[i-1]!=0;i++)
> {
> 	scanf("%f",&m[i]);
> }
> //output
> for(n=1;m[n]==0;n++)
> 	printf("%i card(s)",c(m[n]));
> 
> 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