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

为什么结果是Wrong Answer 呢?请大家帮忙看看

Posted by yeliwei2007 at 2007-04-11 19:30:02 on Problem 1003
#include<stdio.h>
main()
{
float a[10],sum=0.0,n;
int i=0,c;
do
{
scanf("%f",&a[i]);\*这里我省去了判断是否在0.01~5.20之间,应该不是这里错吧*\

}while(a[i++]!=0.0);
for(i=0;a[i]!=0;i++)
{ sum=0.0;
  n=2;
  c=0;
  if(a[i]<=0.5)c=1;
  else
  {
   do
   {
   sum=sum+1/n;
   n=n+1;
   c=c+1;
   }while(sum<a[i]);
  }
printf("%d card(s)\n",c);
}
}

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