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:感觉对的代码AC不了,感觉错的代码却AC了,真郁闷

Posted by fantasyorg at 2007-06-13 10:11:09 on Problem 1003
In Reply To:感觉对的代码AC不了,感觉错的代码却AC了,真郁闷 Posted by:yunyifly at 2007-05-30 21:03:07
#include<iostream>
using namespace std;

int main()
{
	double len, total;
	while(1)
	{
		cin >> len;
		if (len == 0.00)
			break;

		total = 0;
		
		for (int j = 1; total < len; j ++)
			total += 1.0000 / (j + 1); 

		cout << j -1 << " card(s)"  << endl;
	}

}

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