반응형
https://www.acmicpc.net/problem/2998
# @Author YoungMinKim
# baekjoon
a=input() # 2진수
a=list(a)
hap = 0
for i in range(len(a)):
hap+=int(a[i])*2**(len(a)-(i+1)) #10진수
result=[]
while True:
mok = hap//8
nam = hap%8
result.append(nam)
if mok>=8:
hap=mok
continue
else:
result.append(mok)
break
result.reverse()
print(int("".join(map(str, result))))
반응형
'백준 문제풀이' 카테고리의 다른 글
baekjoon - python - 3052 (0) | 2020.08.26 |
---|---|
baekjoon - python - 3046 (0) | 2020.08.26 |
baekjoon - python - 2935 (0) | 2020.08.26 |
baekjoon - python - 2920 (0) | 2020.08.26 |
baekjoon - python - 2914 (0) | 2020.08.26 |
댓글