분류 전체보기(217)
-
BAEKJOON #7576 토마토
이 문제의 저작권은 BAEKJOON에 있습니다. https://www.acmicpc.net/problem/7576 문제는 위 링크에서 확인할 수 있습니다. #토마토 #https://www.acmicpc.net/problem/7576 import sys from collections import deque M, N = map(int, sys.stdin.readline().split()) arr = [list(map(int, sys.stdin.readline().split())) for _ in range(N)] #좌우상하 idx = [-1, 1, 0, 0] idy = [0, 0, 1, -1] get_one = deque() first_cnt = 0 for i in range(N): for j in rang..
2020.04.14 -
Flask를 Heroku에 Deploy하기
1. Deploy 하기 전 준비 git 설치(heroku에 flask프로젝트를 master 해주려면 git이 필요합니다.) heroku 회원가입/설치heroku를 사용하기 위해 heroku 회원가입과 heroku CLI를 설치합니다. Flask 설치 / gunicorn 설치 The Heroku CLI | Heroku Dev Center The Heroku CLILast updated 20 March 2020 The Heroku Command Line Interface (CLI) makes it easy to create and manage your Heroku apps directly from the terminal. It’s an essential part of using Heroku. Download..
2020.04.07 -
BAEKJOON #1015 수열정렬
이 문제의 저작권은 BAEKJOON에 있습니다. https://www.acmicpc.net/problem/1015 문제는 위 링크에서 확인할 수 있습니다. #수열 정렬 #https://www.acmicpc.net/problem/1015 N = int(input()) arr = list(map(int, input().split())) arr2 = sorted(arr) temp = [False] * N for i, a in enumerate(arr2): if a in arr: get_index = arr.index(a) if temp[get_index] is False: arr[get_index] = -1 temp[get_index] = i print(' '.join(map(str, temp))) 풀이 문제..
2020.04.07 -
BAEKJOON #5052 전화번호 목록
이 문제의 저작권은 BAEKJOON에 있습니다. https://www.acmicpc.net/problem/5052 문제는 위 링크에서 확인할 수 있습니다. #전화번호 목록 #https://www.acmicpc.net/problem/5052 import sys def checker(get_phonenum): for j in range(0, N - 1): get_len = len(get_phonenum[j]) if get_phonenum[j] == get_phonenum[j+1][:get_len]: return 'NO' return 'YES' TC = int(sys.stdin.readline()) for tc in range(TC): N = int(sys.stdin.readline()) get_phonenu..
2020.04.06 -
BAEKJOON #1912 연속합
이 문제의 저작권은 BAEKJOON에 있습니다. https://www.acmicpc.net/problem/1912 문제는 위 링크에서 확인할 수 있습니다. N = input() arr = list(map(int, input().split())) ans = -1001 for i in range(1, len(arr)): arr[i] = max(arr[i-1] + arr[i], arr[i]) print(max(arr)) 풀이 for문을 2개 사용해서 모든 연속합중에 작은 값을 찾을수도 있지만 그러면 시간이 너무 많이 걸리게됩니다. 이 문제는 규칙을 파악해서 점화식을 세워야 하는 문제입니다. arr[i] = max(arr[i-1] + arr[i], arr[i]) 위 코드는 배열의 i-1번째 수와 i번째 수를 더..
2020.04.01 -
BAEKJOON #1475 방번호
이 문제의 저작권은 BAEKJOON에 있습니다. https://www.acmicpc.net/problem/1475 문제는 위 링크에서 확인할 수 있습니다. N = input() my_dict = dict() for i in range(0, 10): my_dict[i] = 0 for s in N: s = int(s) if s == 6 and my_dict[s] > my_dict[9]: my_dict[9] += 1 elif s == 9 and my_dict[s] > my_dict[6]: my_dict[6] += 1 else: my_dict[s] += 1 print(max(my_dict.values())) 풀이 숫자 세트는 6과 9가 함께 쓰일 수 있습니다. 6이 9가되고 9가 6이 되기도 합니다. 그렇기 때..
2020.04.01