HangOver

http://acm.zju.edu.cn/show_problem.php?pid=1045

   1 /*written by czk*/
   2 #include <stdio.h>
   3 
   4 int main() {
   5     while(1) {
   6         double l, t;
   7         int i;
   8         scanf("%lf", &l);
   9         if(l==0.0)
  10             break;
  11 
  12         t = 0.0;
  13         for(i = 1; t<l ;i++)
  14             t += 1.0/(i+1);
  15         printf("%d card(s)\n", i-1);
  16     }
  17 }

zju1045 (last edited 2008-06-02 13:13:28 by czk)

ch3n2k.com | Copyright (c) 2004-2020 czk.