본문 바로가기

728x90
반응형
SMALL

코테

(25)
CosPro, PCCP 준비 예. 코테는 언제나 재미있읍니다. 시간도 잘가고 풀릴 때 희열도 엄청나니까요. :) 그래도 뭔가 목표가 있으면 좋을 것 같아서 YBM 주관의 CosPro1급, 프로그래머스 주관의 PCCP 이 두 개를 목표로 공부하고자 합니다. ㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠ 8만 5천원.... 가슴이 너무 아파유... 우선 CosPro 1급 모의고사가 있어서 다시 풀었습니다. ( 진짜 프로그래머스 좋은 것 같아요. ) https://school.programmers.co.kr/learn/courses/11133/11133-cos-pro-1%EA%B8%89-python-%EB%AA%A8%EC%9D%98%EA%B3%A0%EC%82%AC COS Pro 1급 Python 모의고사 현재 IOS/안드로이드 앱 내에서는 결제를 지원하지 않습..
자율 주행 자동차 방향 때문에 머리가 아팠지만 특별한 부분은 없이 시키는데로 구현만 잘하면 됐던 문제였습니다. :) import sys answer = 0 n, m = map(int, sys.stdin.readline().strip().split()) y, x, d = map(int, sys.stdin.readline().strip().split()) dy, dx = [-1, 0, 1, 0], [0, 1, 0, -1] graph = [list(map(int, sys.stdin.readline().strip().split())) for _ in range(n)] visited = [[False for _ in range(m)] for _ in range(n)] check_count = 0 visited[y][x] = Tru..
방화벽 설치하기 아주 예전에 친구들과 1일 1문제 했을 때 풀었던 문제. 위치값 저장해서 방화벽 놓을 수 있는 모든 경우의 수에 불이 퍼지게 해서 최소값만 리턴하면 끝남. import sys import copy from itertools import combinations from collections import deque maxCount = 0 copyGraph = [] def bfs(x, y, n , m): global copyGraph dx, dy = [-1, 1, 0, 0], [0, 0, -1, 1] queue = deque() queue.append((x, y)) while queue: x, y = queue.popleft() for z in range(4): nx = x + dx[z] ny = y + dy..
외주 수익 최대화하기 단순 DP 문제였습니다. 바로 직전 문제에서 chatGPT 에게 try, except 로 뚜드려 맞아서 쉽게 풀었습니다. :) import sys n = int(sys.stdin.readline()) dp = [0 for _ in range(n + 1)] works = [list(map(int, sys.stdin.readline().strip().split())) for _ in range(n)] for i in range(len(works)): dp[i] = max(dp[i], dp[i - 1]) try: dp[i + works[i][0]] = max(works[i][1] + dp[i], dp[i + works[i][0]] ) except: pass print(max(dp))
14500 - 테트로미노 뇌 빼고 모든 케이스를 전부 검사해서 풀었습니다... 전 왜 이럴까요... chatGPT 최고... 모든 모양의 경우의 수의 모양을 만든 다음;; try, except로 인덱스 넘어가는 부분을 넘기고 최고합을 출력하라고... 진짜 천재인듯... 다음에는 그렇게 풀어보겠슴다.. N,M = map(int, input().split()) list_1 =[] for i in range(N): tmp_list = list(map(int,input().split())) list_1.append(tmp_list) list_2 = list(map(list, zip(*list_1))) #가로, 세로 전환 t1 = [] for j in range(1,len(list_1)): #정사각형 for j2 in range(1,le..
바이러스 검사 2015년도에는 이런 문제도 나왔었구나 싶은 문제... 지금은 난이도가 점점 지옥인데요.... import sys n = int(sys.stdin.readline()) stores = list(map(int, sys.stdin.readline().strip().split())) max_boss, max_worker = map(int, sys.stdin.readline().strip().split()) answer = 0 for customers in stores: answer += 1 customers -= max_boss if customers
생명과학부 랩 인턴 단순 시뮬레이션이다 보니 생각보니 오래 걸리지 않았습니다. import sys n, m, k = map(int, sys.stdin.readline().strip().split()) graph = [[ [] for _ in range(m) ] for _ in range(n) ] g_infos = [] dx, dy = [0, 0, 1, -1], [-1, 1, 0, 0] answer = 0 for _ in range(k): x, y, s, d, b = map(int, sys.stdin.readline().strip().split()) graph[x - 1][y - 1].append([s, d - 1, b]) g_infos.append([x - 1, y - 1, s, d - 1, b]) def fight_g()..
2개의 사탕 백트래킹 없이는 시간 초과가 나는 문제였습니다. 그래서 딕셔너리에 현재의 위치와 방향을 key로 그리고 움직인 횟수를 value 갱신해줬더니 풀렸습니다. 헿 import sys, copy, math from collections import deque n, m = map(int, sys.stdin.readline().strip().split()) graph = [list(sys.stdin.readline().strip()) for _ in range(n)] answer = math.inf b_y, b_x = 0, 0 r_y, r_x = 0, 0 g_y, g_x = 0, 0 dy, dx = [-1, 0, 1, 0], [0, 1, 0, -1] move_dict = {} def find_first_candy(..

728x90
반응형
LIST