Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
ssw6750 committed Nov 24, 2022
1 parent 0dfaeaa commit e1fd5dd
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 0 deletions.
36 changes: 36 additions & 0 deletions SWEA/SSAFY 대비/14696.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import sys
input = sys.stdin.readline

n = int(input())

for i in range(n):
ans = ""
ar1 = list(map(int, input().split()))
ar2 = list(map(int, input().split()))

ar1 = ar1[1:]
ar2 = ar2[1:]

if ar1.count(4) > ar2.count(4):
print("A")
elif ar1.count(4) < ar2.count(4):
print("B")
else:
if ar1.count(3) > ar2.count(3):
print("A")
elif ar1.count(3) < ar2.count(3):
print("B")
else:
if ar1.count(2) > ar2.count(2):
print("A")
elif ar1.count(2) < ar2.count(2):
print("B")
else:
if ar1.count(1) > ar2.count(1):
print("A")
elif ar1.count(1) < ar2.count(1):
print("B")
else:
print("D")


35 changes: 35 additions & 0 deletions SWEA/SSAFY 대비/2206.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
dx = [1, -1, 0, 0]
dy = [0, 0, -1, 1]

import sys
from collections import deque
input = sys.stdin.readline

def bfs():
q = deque()
q.append([0, 0, 1])
visit = [[[0] * 2 for i in range(m)] for i in range(n)]
visit[0][0][1] = 1
while q:
x, y, w = q.popleft()
if x == n - 1 and y == m - 1:
return visit[x][y][w]
for i in range(4):
nx = x + dx[i]
ny = y + dy[i]
if 0 <= nx < n and 0 <= ny < m:
if mtx[nx][ny] == 1 and w == 1: # 막히고 뚫을 수 있을때
visit[nx][ny][0] = visit[x][y][1] + 1
q.append([nx, ny, 0])
elif mtx[nx][ny] == 0 and visit[nx][ny][w] == 0: # 방문 상태 확인
visit[nx][ny][w] = visit[x][y][w] + 1
q.append([nx, ny, w])
return -1


n, m = map(int, input().split())
mtx = []
for i in range(n):
mtx.append(list(map(int, list(input().strip()))))

print(bfs())
18 changes: 18 additions & 0 deletions SWEA/SSAFY 대비/2309.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import sys
input = sys.stdin.readline

ar = []
for i in range(9):
ar.append(int(input()))

for i in range(9):
tmp = ar[:]
del tmp[i]
for j in range(8):
tmp2 = tmp[:]
del tmp2[j]
if sum(tmp2) == 100:
tmp2.sort()
for k in range(7):
print(tmp2[k])
exit()

0 comments on commit e1fd5dd

Please sign in to comment.