21842_Binomialcoefficients

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

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

Pro.ID

21842

Title

Binomial coefficients

Title链接

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

AC

1

Submit

1

Ratio

100.00%

时间&空间限制

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

    Gunnar is quite an old and forgetful researcher. Right now he is writing a paper on security in social networks and it actually involves some combinatorics. He wrote a program for calculating binomial coefficients to help him check some of his calculations.

    A binomial coefficient is a number

    where n and k are non-negative integers.

    Gunnar used his program to calculate and got a number m as a result. Unfortunately, since he is forgetful, he forgot the numbers n and k he used as input. These two numbers were a result of a long calculation and they are written on one of many papers lying on his desk. Instead of trying to search for the papers, he tried to reconstruct the numbers n, k from the output he got. Can you help him and find all possible candidates?

    输入

    On the first line a positive integer: the number of test cases, at most 100. After that per test case:

    one line with an integer m ( 2 ≤ m ≤ 1015 ): the output of Gunnar's program.

    输出

    Description

    Gunnar is quite an old and forgetful researcher. Right now he is writing a paper on security in social networks and it actually involves some combinatorics. He wrote a program for calculating binomial coefficients to help him check some of his calculations.

    A binomial coefficient is a number

    where n and k are non-negative integers.

    Gunnar used his program to calculate and got a number m as a result. Unfortunately, since he is forgetful, he forgot the numbers n and k he used as input. These two numbers were a result of a long calculation and they are written on one of many papers lying on his desk. Instead of trying to search for the papers, he tried to reconstruct the numbers n, k from the output he got. Can you help him and find all possible candidates?

    Input

    On the first line a positive integer: the number of test cases, at most 100. After that per test case:

    one line with an integer m ( 2 ≤ m ≤ 1015 ): the output of Gunnar's program.

    Output

    Per test case:

    • one line with an integer: the number of ways of expressing m as a binomial coefficient.

    • one line with all pairs (n, k) that satisfy = m. Order them in increasing order of n and, in case of a tie, order them in increasing order of k. Format them as in the sample output.

    Sample Input

    2
    2
    15

    Sample Output

    1
    (2,1)
    4
    (6,2) (6,4) (15,1) (15,14)

    Source

    样例输入

    2
    2
    15

    样例输出

    1
    (2,1)
    4
    (6,2) (6,4) (15,1) (15,14)

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部