본문 바로가기
python-algorithm

백준 11104 Fridge of Your Dreams

by 무적김두칠 2022. 11. 30.

https://www.acmicpc.net/problem/11104

 

11104번: Fridge of Your Dreams

Eirik drinks a lot of Bingo Cola to help him program faster, and over the years he has burned many unnecessary calories walking all the way to the kitchen to get some. To avoid this he has just bought a small fridge, which is beautifully placed next to his

www.acmicpc.net

 

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

댓글