ACM 1003 Hangover

//1003 Hangover
#include <stdio.h>
#define MAX 100
int main()
{
    float data1[MAX];
    int i=0,j,n;
    float sum;
    do
      {
           scanf("%f",&data1[i++]);
      }while(data1[i-1]!=0.00);
    
         for(j=0;j<i-1;j++)
         {
             sum=0.00;
           for(n=1;sum<data1[j];n++)
                sum=sum+1.0/(n+1);
          
          printf("%d card(s)/n",n-1);
          }        
          return 0;
}
// zdwzzu2006 1003 Accepted 164K 0MS C 421B 2008-01-27 00:48:11
 

你可能感兴趣的:(c,float)