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 faononl at 2004-03-18 20:03:46 on Problem 1607
In Reply To:谁帮我看看还差哪里不对?~ Posted by:peanutgyz at 2004-03-18 18:42:52
> #include <iostream>
> #include <iomanip>
> using namespace std;
> int main()
> {
> 	int n;
> 	
> 
> 	bool b=false;
> 	while(cin>>n)
> 	{
> 		if(b==false)
> 		{
> 			cout<<"Cards  Overhang "<<endl;
> 			b=true;
> 		}
> 		float f=0;  --------------------------------->double
> 		for(int i=1;i<n||i==n;i++)
> 		{	
> 			f+=1.0/(2*(i));
> 		}
> 		if(n<4)
> 		cout<<setw(5)<<n<<"  "<<setw(8)<<showpoint<<std::setprecision(3)<<f<<endl;
> 		else
> 			cout<<setw(5)<<n<<"  "<<setw(8)<<showpoint<<std::setprecision(4)<<f<<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