def encode_number(num_str):num = int(num_str)if num == 0:return "00"bytes_list = while num > 0:byte = num & 0x7F # 取低7位num >>= 7if num > 0:byte |= 0x80 # 设置最高位表示还有后续字节bytes_list.append(byte)# 转换为16进制字符串hex_str = ''.join([f"{byte:02X}" for byte in bytes_list])return hex_str# 读取输入num_str = input.strip# 编码并输出结果print(encode_number(num_str))摘要:def encode_number(num_str):num = int(num_str)if num == 0:return "00"bytes_list = while num > 0:byte = num & 0x7F # 取低7位num >>= 7if
来源:陈星体育谈