public
Authored by
EC2 Bot

周沙曈-实数和函数-U4LA进制转换(已修改)

修改了一些错误

Edited
d657fbd73534bf556704070bee3d9f67.ec2 442 bytes
算始 整数的进制转换(x, b)
    x := 整数(x)
    b := 整数(b)
    
    若始 ( b <= 1 )
        返回 未定义
    若终
    q := "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    若始 ( b <= 37 )
        s := []
        当始 ( x != 0 )
            r := x % b
            x := x // b
            s := [q[r]] + s
        当终
        若始 ( x == 0 )
            返回 [0]
        若终    
        返回 s
    若终 
算终
  • 整体不错,但又一个特殊情况没处理好。比如 x 是 0 时,程序会输出空序列,但应该输出 [0]。请修正。

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