Skip to content

Commit 5e0c104

Browse files
committed
[D2] Title: [파이썬 S/W 문제해결 구현] 1일차 - 이진수2, Time: 57 ms, Memory: 52,736 KB -BaekjoonHub
1 parent 5c4f16f commit 5e0c104

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# [D2] [파이썬 S/W 문제해결 구현] 1일차 - 이진수2 - 5186
2+
3+
[문제 링크](https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AWTtj7GqeAgDFAVT)
4+
5+
### 성능 요약
6+
7+
메모리: 52,736 KB, 시간: 57 ms, 코드길이: 411 Bytes
8+
9+
### 제출 일자
10+
11+
2025-04-27 15:18
12+
13+
14+
15+
> 출처: SW Expert Academy, https://swexpertacademy.com/main/code/problem/problemList.do
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
T = int(input())
2+
3+
def change(n):
4+
cnt = 0
5+
result = ''
6+
a = 1
7+
8+
while n:
9+
if n < 2 ** -a:
10+
result += '0'
11+
else:
12+
n -= 2 ** -a
13+
result += '1'
14+
15+
cnt += 1
16+
if cnt > 12:
17+
return 'overflow'
18+
else:
19+
a += 1
20+
21+
return result
22+
23+
for i in range(1, T+1):
24+
num = float(input())
25+
print(f"#{i} {change(num)}")

0 commit comments

Comments
 (0)