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

请高手指点一下,题简单,可是我不知道为什么错了

Posted by zwjowen at 2010-04-11 15:53:21 on Problem 1003
#include<iostream>
using namespace std;
float cards[280];
int main()
{
	cards[0]=0;
	for(int i=1;i<280;i++){
		cards[i]=cards[i-1]+1/float(i+1);
	}
	float c;
	cin>>c ;
	while(c!=0){
		int k=1;
		for(;k<280;k++){
			if(cards[k]>=c)
				break;
		}
		cout<<k<<" cards(s)"<<endl;
		cin>>c;
	}
	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