d351: 10878 - Decode the tape
http://zerojudge.tw/ShowProblem?problemid=d351
https://zh.wikipedia.org/wiki/ASCII
- string=’A quick brown fox jumps over the lazy dog.’
- for char in string:
- print( ’%8s’ % bin(ord(char))[2:] )
Sample Output 字串的二進位編碼,果真如 Sample Input 圖案
- while True:
- try:
- input()
- string=’’
- while True:
- line=input()
- if line==’___________’:
- break
- byte=’’
- for i in line:
- if i==’o’:
- byte+=’1’
- if i==’ ’:
- byte+=’0’
- string+=chr(int(’0b’+byte,2))
- print(string)
- except:
- break
- while True:
- try:
- input()
- a=[]
- while True:
- aa=input()
- if aa==’___________’:
- break
- a+=[aa]
- for x in range(len(a)):
- a[x]=a[x].replace(’.’,’’).replace(’|’,’’).replace(’o’,’1’).replace(’ ’,’0’)
- for x in range(len(a)):
- a[x]=int(a[x],2)
- a[x]=chr(a[x])
- k=’’
- for x in a:
- k+=x
- print(k)
- except:
- break