10149_FractionstoDecimals

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

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

Pro.ID

10149

Title

Fractions to Decimals

Title链接

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

AC

29

Submit

143

Ratio

20.28%

时间&空间限制

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

    Write a program that will accept a fraction of the form N/D, where N is the numerator and D is the denominator and print the decimal representation. If the decimal representation has a repeating sequence of digits, indicate the sequence by enclosing it in brackets. For example, 1/3 = .33333333...is denoted as 0.(3), and 41/333 = 0.123123123...is denoted as 0.(123). Use xxx.0 to denote an integer. Typical conversions are:

    1/3     =  0.(3)
    22/5    =  4.4
    1/7     =  0.(142857)
    2/2     =  1.0
    3/8     =  0.375
    45/56   =  0.803(571428)

    输入

    A single line with two space separated integers, N and D, 1 ≤ N, D ≤ 100000.

    输出

    Description

    Write a program that will accept a fraction of the form N/D, where N is the numerator and D is the denominator and print the decimal representation. If the decimal representation has a repeating sequence of digits, indicate the sequence by enclosing it in brackets. For example, 1/3 = .33333333...is denoted as 0.(3), and 41/333 = 0.123123123...is denoted as 0.(123). Use xxx.0 to denote an integer. Typical conversions are:

    1/3     =  0.(3)
    22/5    =  4.4
    1/7     =  0.(142857)
    2/2     =  1.0
    3/8     =  0.375
    45/56   =  0.803(571428)

    Input

    A single line with two space separated integers, N and D, 1 ≤ N, D ≤ 100000.

    Output

    The decimal expansion, as detailed above. If the expansion exceeds 76 characters in length, print it on multiple lines wi-th 76 characters per line.

    Sample Input

    45 56

    Sample Output

    0.803(571428)

    Source

    样例输入

    45 56

    样例输出

    0.803(571428)

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部