10129_OrderedFractions

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

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

Pro.ID

10129

Title

Ordered Fractions

Title链接

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

AC

131

Submit

221

Ratio

59.28%

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    Consider the set of all reduced fractions between 0 and 1 inclusive with denominators less than or equal to N.

    Here is the set when N = 5:

    0/1 1/5 1/4 1/3 2/5 1/2 3/5 2/3 3/4 4/5 1/1

    Write a program that, given an integer N between 1 and 160 inclusive, prints the fractions in order of increasing magnitude.

    输入

    Mulitple test case, each case has one line with a single integer N.

    输出

    Description

    Consider the set of all reduced fractions between 0 and 1 inclusive with denominators less than or equal to N.

    Here is the set when N = 5:

    0/1 1/5 1/4 1/3 2/5 1/2 3/5 2/3 3/4 4/5 1/1

    Write a program that, given an integer N between 1 and 160 inclusive, prints the fractions in order of increasing magnitude.

    Input

    Mulitple test case, each case has one line with a single integer N.

    Output

    For each case, output the answer :  one fraction per line, sorted in order of magnitude.

    Output a blank line after each case.

    Sample Input

    5
    4

    Sample Output

    0/1
    1/5
    1/4
    1/3
    2/5
    1/2
    3/5
    2/3
    3/4
    4/5
    1/1

    0/1
    1/4
    1/3
    1/2
    2/3
    3/4
    1/1

    Source

    样例输入

    5
    4

    样例输出

    0/1
    1/5
    1/4
    1/3
    2/5
    1/2
    3/5
    2/3
    3/4
    4/5
    1/1

    0/1
    1/4
    1/3
    1/2
    2/3
    3/4
    1/1

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部