学了半个小时 python↑
写出来的↓
n=1000000 t=16**n s=0 for i in range(n+1000): a=(4*t)//(8*i+1) b=(2*t)//(8*i+4) c=t//(8*i+5) d=t//(8*i+6) s+=a-b-c-d t//=16 x=hex(s)[2:].upper() m=int(input()) p=input().split() for i in range(m): print(x[int(p[i])],end='')