public
Authored by
EC2 Bot

李老师-典型错题-最简分数形式

ac2f5fc430edd897cbf9259a21d4cb36.ec2 399 bytes
算始 最简分数形式 (a,b)
    # a := 整数(a)
    # b := 整数(b)
    r := a
    q := 0
    若始 (a > b)
        r := a % b
        q := a // b
    若终
    # 到这一步,r 是分子,b 分母
    X := r
    y := b
    当始 (y != 0)
        temp := X
        X := y
        y := temp % x
    当终
    输出 整数部分 q
    输出 分子 r // x
    输出 分母 b // x
算终
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment