본문 바로가기

분류 전체보기

(257)
프로그래머스)[3차] 파일명 정렬 https://school.programmers.co.kr/learn/courses/30/lessons/17686# 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import re def solution(files): answer = [] dic={} for i in files: a = re.split(r"([0-9]+)", i) dic[i] = a # a = re.findall(r'\d+|\D+', i) # for j in range(len(a)): # a[j] = a[j].replace(" ","") # a[j] = a[j].replace(',',''..
프로그래머스)두 정수 사이의 합-python https://school.programmers.co.kr/learn/courses/30/lessons/12912 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr def solution(a, b): answer = 0 if a > b: a,b = b,a for i in range(a,b+1): answer += i return answer 점수도 안주는 문제였다... 근데 자기 전에 한문제라도 풀어보고자 풀어봤다..흑흑...
React)경고- react_devtools_backend.js:4012 Warning: You provided a `checked` prop to a form field without an `onChange` handler. 해당 경고가 나온 코드를 보자. 경고 표시를 잘 읽어보면 "onChange가 없이 렌더링 됐습니다."라고 나온다. onChange함수를 추가해주면 간단하게 해결된다.
프로그래머스)[1]차 다트 게임-pyhton https://school.programmers.co.kr/learn/courses/30/lessons/17682 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import re def solution(dartResult): answer = 0 dart = re.split('([*,#,S,D,T])',dartResult) stack = [] num = 0 for i in dart: if i.isdigit(): num = int(i) elif i in ['*','#']: if i == '*': stack[-1] = stack[-1] * 2 if len(st..
백준4963)섬의 개수-python https://www.acmicpc.net/problem/4963 import sys read = sys.stdin.readline sys.setrecursionlimit(10000) def dfs(x,y,visit,arr): visit[x][y] = True dx = [0,0,1,-1,-1,-1,1,1] dy = [1,-1,0,0,-1,1,-1,1] for i in range(len(dx)): nx = dx[i] + x ny = dy[i] + y if (0
백준10815)숫자카드-pyhton https://www.acmicpc.net/problem/10815 10815번: 숫자 카드 첫째 줄에 상근이가 가지고 있는 숫자 카드의 개수 N(1 ≤ N ≤ 500,000)이 주어진다. 둘째 줄에는 숫자 카드에 적혀있는 정수가 주어진다. 숫자 카드에 적혀있는 수는 -10,000,000보다 크거나 같고, 10, www.acmicpc.net a = int(input()) arr = list(map(int,input().split())) b = int(input()) arr2 = list(map(int,input().split())) arr.sort() def b(start,end,target): mid = (start + end) // 2 if end < start: return 0 if arr[mid]..
백준1654)랜선 자르기-python https://www.acmicpc.net/problem/1654 1654번: 랜선 자르기 첫째 줄에는 오영식이 이미 가지고 있는 랜선의 개수 K, 그리고 필요한 랜선의 개수 N이 입력된다. K는 1이상 10,000이하의 정수이고, N은 1이상 1,000,000이하의 정수이다. 그리고 항상 K ≦ N 이다. 그 www.acmicpc.net n,m = map(int,input().split()) arr = [] for _ in range(n): a = int(input()) arr.append(a) start = 1 end = max(arr) while start = mid: line += i // mid if line < m: end = mid - 1 else: start = mid + 1 print(e..
백준)숫자카드-python https://www.acmicpc.net/problem/10816 이문제는 이분탐색으로 분류됐지만 사실 이분탐색을 사용하지는 않았다. 단순히 딕셔너리에 숫자와 그 개수를 담고 그대로 출력하면 된다. 굉장히 간단한 문제다. from collections import Counter a = int(input()) arr = list(map(int,input().split())) arr.sort() b = int(input()) arr2 =list(map(int,input().split())) dic = Counter(arr) for i in arr2: if i in dic: print(dic[i],end=' ') else: print(0,end=' ')