poj1003

简单题

View Code
#include <iostream>

using namespace std;



int main()

{

    double    now, c;

    int        i;



    //freopen("t.txt", "r", stdin);

    while (cin >> c && c != 0)

    {

        now = 0;

        i = 2;

        while (now < c)

        {

            now += 1.0 / i;

            i++;

        }

        printf("%d card(s)\n", i - 2);

    }

    return 0;

}

你可能感兴趣的:(poj)