poj-1003 Hangover

2019-11-28

1003 简化代码,也别把问题想复杂

#include <stdio.h>
#include <stdlib.h>


int main()
{
    float c,sum,base;
    int count;
    scanf("%f",&c);
    while(c!=0.00)
    {
        base=2;
        sum=1/base;
        count=1;
        while(sum<c)
        {
            base++;
            sum+=1/base;
            count++;
        }
        printf("%d card(s)
",count);
        scanf("%f",&c);
    }
    return 0;
}
Aim: Buaa
原文地址:https://www.cnblogs.com/calm-blogme/p/11966987.html