ZOJ1045 handover解答。

os posted @ 2013年9月09日 11:43 in ACM , 805 阅读

acm 题目List

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1045

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdio.h>
 
int main()
{
    float c;
    while(scanf("%f", &c) && c !=0)
    {
        int i = 2;
        float fResult = 0;
        while (fResult < c)
        {
            fResult += 1.00/i;
            i++;
        }
        printf("%d card(s)\n", i - 2);
    }
    return 0;
}

登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter