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:我做的C

Posted by xiaomi7732 at 2005-09-04 10:58:39 on Problem 1003
In Reply To:Re:我做的C Posted by:820517 at 2004-09-30 12:47:32
#include<iostream>
using namespace std;
int cal(float dest){
	int n=1;
	float sum=0;
	while(sum<dest){
		sum+=1.0/(n+1);
		n++;
	}
	return --n;
}

void main(void){
	int n;
	float in;
	cin>>in;
	while(in!=0.00){
		n=cal(in);
		cout<<n<<" card(s)"<<endl;
		cin>>in;
	}

}
晕,这个就通过了。

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