Poj Solution 1003

http://poj.org/problem?id=1003

#include <stdio.h>
#include <stdlib.h>
#define DEBUG 0
int main(void) {
     if(DEBUG)
     freopen("in","r",stdin);

     float c;
     while(scanf("%f",&c)&&c!=0){
       int i=2;
       float rs=0;
       while(rs<c){
          rs+=1.0/i;
          i++;
       }
       printf("%d card(s)n",i-2);
     }

    return 0;
}

											
This entry was posted in poj. Bookmark the permalink.