add: swea/1928.py

This commit is contained in:
Gyubin Han
2024-05-04 20:33:44 +09:00
parent c3d9a02062
commit a0324ecaf5

24
swea/1928.py Normal file
View File

@@ -0,0 +1,24 @@
# 이 문제를 별도의 모듈을 사용하지 않고 해결
base64Table="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
base64Dict={}
for i in range(len(base64Table)):
c=base64Table[i]
base64Dict[c]=i
n=int(input())
for i in range(1,n+1):
s=input()
buffer=0
count=0
resultString=""
for c in s:
buffer=(buffer<<6)|base64Dict[c]
count+=6
if count>=8:
count-=8
resultString+=chr((buffer>>count)&0xff)
buffer&=(1<<count)-1
print("#"+str(i),resultString)