题解 | #整数与IP地址间的转换#
整数与IP地址间的转换
https://www.nowcoder.com/practice/66ca0e28f90c42a196afd78cc9c496ea
# 2024年10月30日 周三 上午10:04 ip = list(map(int, input().split("."))) n = int(input()) s = "" for i in ip: t = bin(i)[2:].zfill(8) s += t print(int(s, 2)) a = bin(n)[2:].zfill(32) # print(a) ls = [] for i in range(0, len(a), 8): b = int(a[i : i + 8], 2) ls.append(b) print(".".join(map(str, ls)))