Pro.ID10075 TitleCoupons Title链接http://10.20.2.8/oj/exercise/problem?problem_id=10075 AC1 Submit1 Ratio100.00% 时间&空间限制描述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 作者 |