1 분 소요

1. 문제

[Bronze I] Fridge of Your Dreams - 11104

문제 링크

성능 요약

메모리: 30840 KB, 시간: 144 ms

분류

구현(implementation), 수학(math)

문제 설명

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 computer. To make it match his fancy big-tower with all its blinking LEDs, it is necessary to style it a bit.

He has bought a weight sensor with a display and a small general purpose programmable chip, to put underneath the fridge. The idea is to make the display show how many litres of Bingo Cola there is in the fridge. To do this he must read a binary register in the sensor, and convert it to a decimal number to be displayed.

입력

The first line of input gives n ≤ 1000, the number of test cases. Then follow n lines with positive numbers represented as 24-bit binary strings (0s and 1s).

출력

For each number, output its decimal representation, without any leading zeros.

출처: 백준, https://https://www.acmicpc.net/

2. 해결방법 시간복잡도

  1. 단순 코딩 O(N)

3. 문제 해결 및 코드


  • 주석을 참고하면서 이해를 돕습니다.

4. 알고리즘 및 해설

  1. 문제의 요점은 받은 값도 2진수로 변경해서 출력하는 것이다.
  2. 반복문을 통해 해당 값을 계속 받아서 출력해준다.