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 04408118 at 2010-08-13 19:43:32 on Problem 1003
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{

   float a[100];
   float s;
   int k(1),n(1);
   cin>>a[0];
   for(int i=1;a[i-1]!=0;i++)
   {
	   cin>>a[i];
	   
   }
  for(int j=0;a[j]!=0;j++)
   {
	  s=0;
	  for(int k=1;s<a[j];k++)
	   {

		   s=s+1.0/(k+1);
	   }
	   cout<<k-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