一次翻译的完整记录
运行下面这段程序,填写它打印出来的结果。
PAGE = 16
PT = {0: 3, 1: 0, 2: 5}
def split(va):
return va // PAGE, va % PAGE
def translate(va):
vp, off = split(va)
if vp not in PT:
return -1
return PT[vp] * PAGE + off
va = 37
vp, off = split(va)
pp = PT[vp]
pa = pp * PAGE + off
print(str(va) + "/" + str(vp) + "-" + str(off) + "/"
+ str(pp) + "/" + str(pa))
全部评论