https://www.acmicpc.net/problem/11104
1
2
3
4
5
6
7
8
9
10
|
def sol(n):
answer = int(n,2)
return answer
if __name__ == '__main__':
t = int(input())
for _ in range(t):
n = input()
print(sol(n))
|
cs |
2진법 숫자를 10진법으로 바꾸는 내용이고 int 함수에 원하는 숫자를 '문자열'로 넣고, 진법에 해당하는 수를 넣습니다.
It is about converting a binary number to a decimal system. Put the number you want as a 'string' in the int function and put the number corresponding to the base system.
반응형
'python-algorithm' 카테고리의 다른 글
백준 14954 Happy Number (0) | 2022.11.30 |
---|---|
백준 12778 CTP공국으로 이민 가자 (0) | 2022.11.30 |
백준 26082 WARBOY (0) | 2022.11.30 |
백준 25828 Corona Virus Testing (0) | 2022.11.30 |
백준 17903 Counting Clauses (0) | 2022.11.30 |
댓글