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 lecho at 2009-03-09 16:27:59 on Problem 1003 and last updated at 2009-03-09 16:28:18
#include<iostream>
#include<vector>
using namespace std;
int main()
{
	double a,b=0.5;
	vector<double> vnum;
	int num=0;

	cin>>a;
	while(a!=0.00){
        while(b<a){
			b=0;
			num++;
			for(double i=1;i<=num+1;++i){
			     b+=1/(i+1);
			}
			
		}
		vnum.push_back(num);
		cin>>a;
		num=0;
	}
	for(int j=0;j!=vnum.size();++j){
		cout<<vnum[j]+1<<" card(s)"<<endl;
	}
	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