1 条题解

  • 0

    AC题解

    text = input()
    ascii_text = ''
    binary = lambda n: "" if n==0 else binary(n//2) + str(n%2)
    txt = ''
    for i in text:
        ascii_text = str(ord(i))
        ascii_text = int(ascii_text)
        num = str(binary(ascii_text))
        num = num[len(num) - 4:len(num)]#1010
        num = int(num,base=2)
        if num >= 0 and num <= 7:
            txt += str(num)
        elif num == 8:
            txt += 'E'
        elif num == 9:
            txt += 'S'
        elif num == 10:
            txt += 'W'
        elif num == 11:
            txt += 'N'
        elif num == 12:
            txt += 'ES'
        elif num == 13:
            txt += 'EN'
        elif num == 14:
            txt += 'WS'
        elif num == 15:
            txt += 'WN'
    print(txt)
    
    
    • 1

    信息

    ID
    1382
    时间
    1000ms
    内存
    128MiB
    难度
    8
    标签
    递交数
    11
    已通过
    8
    上传者