def nsjz(y) # 把16/25/27/32/36进制数转换为10进制数
num=0
sn=[]
x=0
n=self.to_i
s=y.to_s
self_array = y.to_s.scan(/./) # 分割每一位上的数字
for char in self_array # 获取位数
sn[x]=char.to_s
if n==16
sn[x]="00" if sn[x]=="0"
sn[x]="01" if sn[x]=="1"
sn[x]="02" if sn[x]=="2"
sn[x]="03" if sn[x]=="3"
sn[x]="10" if sn[x]=="4"
sn[x]="11" if sn[x]=="5"
sn[x]="12" if sn[x]=="6"
sn[x]="13" if sn[x]=="7"
sn[x]="20" if sn[x]=="8"
sn[x]="21" if sn[x]=="9"
sn[x]="22" if sn[x]=="A"
sn[x]="23" if sn[x]=="B"
sn[x]="30" if sn[x]=="C"
sn[x]="31" if sn[x]=="D"
sn[x]="32" if sn[x]=="E"
sn[x]="33" if sn[x]=="F"
elsif n==25
sn[x]="00" if sn[x]=="0"
sn[x]="01" if sn[x]=="1"
sn[x]="02" if sn[x]=="2"
sn[x]="03" if sn[x]=="3"
sn[x]="04" if sn[x]=="4"
sn[x]="10" if sn[x]=="5"
sn[x]="11" if sn[x]=="6"
sn[x]="12" if sn[x]=="7"
sn[x]="13" if sn[x]=="8"
sn[x]="14" if sn[x]=="9"
sn[x]="20" if sn[x]=="A"
sn[x]="21" if sn[x]=="B"
sn[x]="22" if sn[x]=="C"
sn[x]="23" if sn[x]=="D"
sn[x]="24" if sn[x]=="E"
sn[x]="30" if sn[x]=="F"
sn[x]="31" if sn[x]=="G"
sn[x]="32" if sn[x]=="H"
sn[x]="33" if sn[x]=="I"
sn[x]="34" if sn[x]=="J"
sn[x]="40" if sn[x]=="K"
sn[x]="41" if sn[x]=="L"
sn[x]="42" if sn[x]=="M"
sn[x]="43" if sn[x]=="N"
sn[x]="44" if sn[x]=="O"
elsif n==27
sn[x]="000" if sn[x]=="0"
sn[x]="001" if sn[x]=="1"
sn[x]="002" if sn[x]=="2"
sn[x]="010" if sn[x]=="3"
sn[x]="011" if sn[x]=="4"
sn[x]="012" if sn[x]=="5"
sn[x]="020" if sn[x]=="6"
sn[x]="021" if sn[x]=="7"
sn[x]="022" if sn[x]=="8"
sn[x]="100" if sn[x]=="9"
sn[x]="101" if sn[x]=="A"
sn[x]="102" if sn[x]=="B"
sn[x]="110" if sn[x]=="C"
sn[x]="111" if sn[x]=="D"
sn[x]="112" if sn[x]=="E"
sn[x]="120" if sn[x]=="F"
sn[x]="121" if sn[x]=="G"
sn[x]="122" if sn[x]=="H"
sn[x]="200" if sn[x]=="I"
sn[x]="201" if sn[x]=="J"
sn[x]="202" if sn[x]=="K"
sn[x]="210" if sn[x]=="L"
sn[x]="211" if sn[x]=="M"
sn[x]="212" if sn[x]=="N"
sn[x]="220" if sn[x]=="O"
sn[x]="221" if sn[x]=="P"
sn[x]="222" if sn[x]=="Q"
elsif n==32
sn[x]="00000" if sn[x]=="0"
sn[x]="00001" if sn[x]=="1"
sn[x]="00010" if sn[x]=="2"
sn[x]="00011" if sn[x]=="3"
sn[x]="00100" if sn[x]=="4"
sn[x]="00101" if sn[x]=="5"
sn[x]="00110" if sn[x]=="6"
sn[x]="00111" if sn[x]=="7"
sn[x]="01000" if sn[x]=="8"
sn[x]="01001" if sn[x]=="9"
sn[x]="01010" if sn[x]=="A"
sn[x]="01011" if sn[x]=="B"
sn[x]="01100" if sn[x]=="C"
sn[x]="01101" if sn[x]=="D"
sn[x]="01110" if sn[x]=="E"
sn[x]="01111" if sn[x]=="F"
sn[x]="10000" if sn[x]=="G"
sn[x]="10001" if sn[x]=="H"
sn[x]="10010" if sn[x]=="I"
sn[x]="10011" if sn[x]=="J"
sn[x]="10100" if sn[x]=="K"
sn[x]="10101" if sn[x]=="L"
sn[x]="10110" if sn[x]=="M"
sn[x]="10111" if sn[x]=="N"
sn[x]="11000" if sn[x]=="O"
sn[x]="11001" if sn[x]=="P"
sn[x]="11010" if sn[x]=="Q"
sn[x]="11011" if sn[x]=="R"
sn[x]="11100" if sn[x]=="S"
sn[x]="11101" if sn[x]=="T"
sn[x]="11110" if sn[x]=="U"
sn[x]="11111" if sn[x]=="V"
elsif n==36
sn[x]="00" if sn[x]=="0"
sn[x]="01" if sn[x]=="1"
sn[x]="02" if sn[x]=="2"
sn[x]="03" if sn[x]=="3"
sn[x]="04" if sn[x]=="4"
sn[x]="05" if sn[x]=="5"
sn[x]="10" if sn[x]=="6"
sn[x]="11" if sn[x]=="7"
sn[x]="12" if sn[x]=="8"
sn[x]="13" if sn[x]=="9"
sn[x]="14" if sn[x]=="A"
sn[x]="15" if sn[x]=="B"
sn[x]="20" if sn[x]=="C"
sn[x]="21" if sn[x]=="D"
sn[x]="22" if sn[x]=="E"
sn[x]="23" if sn[x]=="F"
sn[x]="24" if sn[x]=="G"
sn[x]="25" if sn[x]=="H"
sn[x]="30" if sn[x]=="I"
sn[x]="31" if sn[x]=="J"
sn[x]="32" if sn[x]=="K"
sn[x]="33" if sn[x]=="L"
sn[x]="34" if sn[x]=="M"
sn[x]="35" if sn[x]=="N"
sn[x]="40" if sn[x]=="O"
sn[x]="41" if sn[x]=="P"
sn[x]="42" if sn[x]=="Q"
sn[x]="43" if sn[x]=="R"
sn[x]="44" if sn[x]=="S"
sn[x]="45" if sn[x]=="T"
sn[x]="50" if sn[x]=="U"
sn[x]="51" if sn[x]=="V"
sn[x]="52" if sn[x]=="W"
sn[x]="53" if sn[x]=="X"
sn[x]="54" if sn[x]=="Y"
sn[x]="55" if sn[x]=="Z"
else
exit
end
x+=1
end
for i in 0...sn.size
num=num.to_s+sn[i].to_s
end
if n==16
n=4
elsif n==25
n=5
elsif n==27
n=3
elsif n==32
n=2
elsif n==36
n=6
end
num=(num.to_i).sjz(n)
return num.truncate == num ? num.truncate : num
end