반응형
https://www.acmicpc.net/problem/1212
1212번: 8진수 2진수
첫째 줄에 8진수가 주어진다. 주어지는 수의 길이는 333,334을 넘지 않는다.
www.acmicpc.net
# @Author YoungMinKim
# baekjoon
print(bin(int(input(), 8))[2:])
원래 초기코드는...
# N=list(input())
# ten=0
# tmp=[]
# for i in range(len(N)):
# ten+=int(N[-(i+1)])*(8**i)
# while ten!=0:
# tmp.append(ten%2)
# ten=ten//2
# result=''
# for i in range(len(tmp)):
# result+=str(tmp[-(i+1)])
# print(int(result))
였지만 계속 시간초과 에러떠서 결국 바꿨다.
반응형
'백준 문제풀이' 카테고리의 다른 글
baekjoon - python - 1330 (0) | 2020.08.21 |
---|---|
baekjoon - python - 1237 (0) | 2020.08.21 |
baekjoon - python - 1157 (0) | 2020.08.21 |
baekjoon - python - 1152 (0) | 2020.08.21 |
baekjoon - python - 1110 (0) | 2020.08.21 |
댓글