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

测试都过,但OJ总是WA

Posted by 627757940 at 2012-07-09 14:33:21 on Problem 1003
#include<stdio.h>
int main(void)
{
  int i = 0;
  float length[100];
  for(i = 0;;i++){
    scanf("%f",&length[i]);
    if(length[i] == 0.00)
      break;
  }
  for(i = 0;length[i] != 0.00;i++){
    float sum = 0;
    float divisor = 2;
    if(length[i] < 0.01 || length[i] >=5.20){
      break;
    }
    else {
      for(;sum <= length[i];divisor++)
        sum += (float)1 / divisor;
      printf("%0.f card%c\n",divisor - 2,(divisor - 2 > 1)?'s':' ');
    }
  }
}

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