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 yy17yy at 2010-08-15 00:02:43 on Problem 1003
In Reply To:答案不正确为啥???帮忙指教一下 Posted by:04408118 at 2010-08-13 19:43:32
#include <iostream>
using namespace std;
double length[300];
int main()
{
	memset(length,0,sizeof(length));
	int i;
	double len;
	while(cin>>len)
	{
		if(len==0)
			break;

		for(i=1;i<300;i++)
		{
			if(length[i]==0)
				length[i]=length[i-1]+1.0/(i+1);
			if(length[i]>=len)
			{
				cout<<i<<' '<<"card(s)"<<endl;
				break;
			}
		}
	}
	return 0;
}

我的,,请不要那样输入数据,你那样是一次输完,,然后再输出结果,,实际要求是输入一个数据出一个结果,,具体参见1001的说明,,,

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