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 shanlagezai at 2011-10-11 11:54:49 on Problem 1003
In Reply To:两次才过,汗。每次都没题目输入而烦恼,到底是循环输入还是每次都单独输入。 Posted by:raycool at 2010-12-25 15:19:41
> #include<stdio.h>
> int main(void)
> {   float i;
> 	while(scanf("%f",&i)==1)
> 	{
> 		float sum=0;
> 		int j=0,k=2;
> 		if(i==0.00)
> 		return 0;
> 	do 
> 	{sum+=(float)1/k;
> 	k++;
> 	j++;
> 	} while (sum<i);
> 	printf("%d card(s)\n",j);
> 	}
> 	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