10075_Coupons

2022-5-16 18:16| 发布者: Hocassian| 查看: 69| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-3-89504517891200-Problem List-采集的数据-后羿采集器.html

Pro.ID

10075

Title

Coupons

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=10075

AC

1

Submit

1

Ratio

100.00%

时间&空间限制

  • Time Limit: 1000/500 MS (Java/Others)     Memory Limit: 32768/32768 K (Java/Others)
  • 描述

    Coupons in cereal boxes are numbered 1 to n, and a set of one of each is required for a prize (a cereal box, of course). With one coupon per box, how many boxes on average are required to make a complete set of n coupons?

    输入

    Input consists of a sequence of lines each containing a single positive integer n, 1 ≤ n 22, giving the size of the set of coupons.

    输出

    Description

    Coupons in cereal boxes are numbered 1 to n, and a set of one of each is required for a prize (a cereal box, of course). With one coupon per box, how many boxes on average are required to make a complete set of n coupons?

    Input

    Input consists of a sequence of lines each containing a single positive integer n, 1 ≤ n 22, giving the size of the set of coupons.

    Output

    For each input line, output the average number of boxes required to collect the complete set of n coupons. If the answer is an integer number, output the number. If the answer is not integer, then output the integer part of the answer followed by a space and then by the proper fraction in the format shown below. The fractional part should be irreducible. There should be no trailing spaces in any line of ouput.

    Sample Input
    2
    5
    17
    Sample Output
    3
       5
    11 --
       12
       340463
    58 ------
       720720
    Source

    样例输入

    2
    5
    17

    样例输出

    3
       5
    11 --
       12
       340463
    58 ------
       720720

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部