21507_CountonCanton

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

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

Pro.ID

21507

Title

Count on Canton

Title链接

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

AC

9

Submit

13

Ratio

69.23%

时间&空间限制

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

    One of the famous proofs of modern mathematics is Georg Cantor's demonstration that the set of rational numbers is enumerable. The proof works by using an explicit enumeration of rational numbers as shown in the diagram below.

    1/1  1/2  1/3  1/4  1/5  ...
    2/1  2/2  2/3  2/4
    3/1  3/2  3/3
    4/1  4/2
    5/1

    In the above diagram, the first term is 1/1, the second term is 1/2, the third term is 2/1, the fourth term is 3/1, the fifth term is 2/2, and so on.

    输入

    The input list contains a single number per line and will be terminated by end-of-file.

    输出

    Description

    One of the famous proofs of modern mathematics is Georg Cantor's demonstration that the set of rational numbers is enumerable. The proof works by using an explicit enumeration of rational numbers as shown in the diagram below.

    1/1  1/2  1/3  1/4  1/5  ...
    2/1  2/2  2/3  2/4
    3/1  3/2  3/3
    4/1  4/2
    5/1

    In the above diagram, the first term is 1/1, the second term is 1/2, the third term is 2/1, the fourth term is 3/1, the fifth term is 2/2, and so on.

    Input

    The input list contains a single number per line and will be terminated by end-of-file.

    Output

    You are to write a program that will read a list of numbers in the range from 1 to 107 and will print for each number the corresponding term in Cantor's enumeration as given below.

    Sample Input
    3
    14
    7
    Sample Output
    TERM 3 IS 2/1
    TERM 14 IS 2/4
    TERM 7 IS 1/4
    Source

    样例输入

    3
    14
    7

    样例输出

    TERM 3 IS 2/1
    TERM 14 IS 2/4
    TERM 7 IS 1/4

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部