본문 바로가기

전체 글

(102)
[Algorithm|Python] 백준 11399번 / 99클럽 17일차 TIL N = int(input())arr = list(map(int,input().split()))arr.sort()result=0time=0for i in range(N): time += arr[i] result += time print(result)
[Algorithm|Python] 백준 27961번 / 99클럽 16일차 TIL N = int(input())cnt = 1cat = 1if N == 0: print(0)else: while cat
[Algorithm|Python] 백준 15686번 / 99클럽 15일차 TIL N,M = map(int,input().split())min_ans = 99999999home = []chick = []for i in range(N): # 집과 치킨의 좌표를 리스트에 넣어준다. row = list(map(int,input().split())) for j in range(N): if row[j] == 1: home.append((i,j)) elif row[j]==2: chick.append((i,j))visited = [False] * len(chick)def dfs(idx,cnt): global min_ans if cnt == M: # print(visited[:]) ans ..
[Algorithm|Python] 백준 2615번 / 99클럽 14일차 TIL import sysboard = [list(map(int, sys.stdin.readline().split())) for _ in range(19)]move= [[1,0],[1,1],[0,1],[-1,1]]N = 19result = 0for i in range(N): for j in range(N): if board[i][j] != 0: stone = board[i][j] for dy, dx in move: ny, nx, cnt = i + dy, j + dx, 1 while 0 0: print(result) print(y+1,x+1..
[Algorithm|Python] 백준 2529번 / 99클럽 13일차 TIL def get_num(x, y, oper): if oper == ' y : return False else: if x
[Algorithm|Python] 백준 1051번 / 99클럽 12일차 TIL N, M = map(int, input().split())A = [list(input()) for _ in range(N)]side = 0for k in range(min(N, M), 0, -1): for i in range(N - k): for j in range(M - k): if A[i][j] == A[i][j+k] == A[i+k][j] == A[i+k][j+k]: side = max(side, k+1) if side != 0: print((side)**2)else: print(1)
[Algorithm|Python] 백준 1018번 / 99클럽 코테 스터디 11일차 TIL N, M = map(int, input().split())board = []result = []for _ in range(N): board.append(input()) for i in range(N-7): for j in range(M-7): B = 0 W = 0 for a in range(i, i+8): for b in range(j, j+8): if (a+b)%2 == 0: if board[a][b] != 'B': B += 1 if board[a][b] != 'W': ..
[Algorithm|Python] 백준 2776번 / 99클럽 코테 스터디 10일차 TIL import sysfrom collections import dequeinput = sys.stdin.readlinedef bfs(x, y): q = deque([(x, y)]) visited[x][y] = 1 seaList = [] while q: x, y = q.popleft() sea = 0 for i in range(4): nx = x + dx[i] ny = y + dy[i] if 0 0: seaList.append((x, y, sea)) for x, y, sea in seaList: graph[x][y] = max(0, graph[x][y]..