Skip to content

Commit 9147d7a

Browse files
authored
Merge pull request #503 from jihye1006/main
[최지혜] 60차 라이브코테 제출
2 parents 657d611 + 0023dbd commit 9147d7a

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed

live5/test60/문제1/최지혜.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import sys
2+
input = sys.stdin.readline
3+
4+
st1 = list(input().rstrip()) # 첫째 줄에 입력받은 문자열 (커서 기준 왼쪽)
5+
st2 = [] # 커서 기준 오른쪽
6+
7+
for _ in range(int(input().strip())):
8+
command = input().split()
9+
if command[0] == 'L': # L이면 커서가 왼쪽으로 한칸 옮긴 것처럼 표현
10+
if st1:
11+
st2.append(st1.pop())
12+
elif command[0] == 'D': # D이면 커서가 오른쪽으로 한칸 옮긴 것처럼
13+
if st2:
14+
st1.append(st2.pop())
15+
elif command[0] == 'B': # B이면 왼쪽에 있는 문자가 삭제된 것처럼
16+
if st1:
17+
st1.pop()
18+
else:
19+
st1.append(command[1]) # P $이면 st1에 추가되게끔 함으로써 커서 왼쪽에 문자가 추가된 것처럼 표현
20+
21+
st1.extend(reversed(st2)) # 뒤집어서 추가
22+
print(''.join(st1))

live5/test60/문제2/최지혜.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import sys
2+
input = sys.stdin.readline
3+
4+
n, k = input().split()
5+
player = set()
6+
7+
for _ in range(int(n)):
8+
player.add(input().rstrip())
9+
10+
p = len(player) # 중복이 제외된 플레이어 수
11+
12+
if k == 'Y': # 윷놀이
13+
print(p)
14+
elif k == 'F': # 같은 그림 찾기
15+
print(p//2)
16+
else: # 원카드
17+
print(p//3)

live5/test60/문제3/최지혜.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
def solution(s):
2+
a, b = 0, 0
3+
while s != '1':
4+
a += 1
5+
num = s.count('1')
6+
b += len(s) - num
7+
s = bin(num)[2:]
8+
return [a, b]

0 commit comments

Comments
 (0)