일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
- hackerrank
- 우분투
- leetcode
- gs25
- 데이콘
- github
- 편스토랑
- 캐치카페
- 맥북
- Real or Not? NLP with Disaster Tweets
- 자연어처리
- SW Expert Academy
- Docker
- Kaggle
- 편스토랑 우승상품
- AI 경진대회
- 코로나19
- 금융문자분석경진대회
- dacon
- 프로그래머스
- 프로그래머스 파이썬
- 파이썬
- Baekjoon
- ChatGPT
- 백준
- Git
- ubuntu
- 더현대서울 맛집
- programmers
- PYTHON
- Today
- Total
목록
반응형
2020/05 (36)
솜씨좋은장씨
1일 1문제 114일차! 오늘의 문제는 백준의 진법 변환입니다. 2745번: 진법 변환 B진법 수 N이 주어진다. 이 수를 10진법으로 바꿔 출력하는 프로그램을 작성하시오. 10진법을 넘어가는 진법은 숫자로 표시할 수 없는 자리가 있다. 이런 경우에는 다음과 같이 알파벳 대문자를 www.acmicpc.net Solution B_jinbub_dic2 = { '0':0, '1':1, '2':2, '3':3, '4':4, '5':5, '6':6, '7':7, '8':8, '9':9, 'A':10, 'B':11, 'C':12, 'D':13, 'E':14, 'F':15, 'G':16, 'H':17, 'I':18, 'J':19, 'K':20, 'L':21, 'M':22, 'N':23, 'O':24, 'P':25, ..
1일 1문제 113일차! 오늘의 문제는 백준의 합분해 입니다. 2225번: 합분해 첫째 줄에 답을 1,000,000,000으로 나눈 나머지를 출력한다. www.acmicpc.net Solution inputNums = input() inputNums = inputNums.split() N = int(inputNums[0]) K = int(inputNums[1]) nc = [[0]*(N+1) for _ in range(K+1)] nc[0][0] = 1 # nc[0][0] = 1 for i in range(1, K+1): for j in range(0, N+1): nc[i][j] = nc[i-1][j] + nc[i][j-1] nc[i][j] = nc[i][j] % 1000000000 # print(nc) p..
1일 1문제 112일차! 오늘의 문제는 백준의 포도주 시식입니다. 2156번: 포도주 시식 효주는 포도주 시식회에 갔다. 그 곳에 갔더니, 테이블 위에 다양한 포도주가 들어있는 포도주 잔이 일렬로 놓여 있었다. 효주는 포도주 시식을 하려고 하는데, 여기에는 다음과 같은 두 가지 규 www.acmicpc.net Solution inputNum = int(input()) amount_of_wine = [] for i in range(inputNum): ryang = int(input()) amount_of_wine.append(ryang) nc = [[0]*3 for _ in range(inputNum+1)] for i in range(1, inputNum+1): nc[i][0] = max(nc[i-1]) ..
Your algorithms have become so good at predicting the market that you now know what the share price of Wooden Orange Toothpicks Inc. (WOT) will be for the next number of days. Each day, you can either buy one share of WOT, sell any number of shares of WOT that you own, or not make any transaction at all. What is the maximum profit you can obtain with an optimum trading strategy? For example, if ..
1일 1문제 110일차! 오늘의 문제는 SW Expert Academy의 홀수만 더하기 입니다. SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com Solution T = int(input()) for i in range(T): numbers = list(map(int, input().split())) odd_nums = [num for num in numbers if num % 2 == 1] print("#{} {}".format(i+1, sum(odd_nums))) SOMJANG/CODINGTEST_PRACTICE 1일 1문제 since 2020.02.07. Contribute to SOMJANG/CODINGT..
1일 1문제 109일차! 오늘의 문제는 SW Expert Academy의 홀수일까 짝수일까입니다. SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com Solution loop_num = int(input()) for i in range(loop_num): input_num = int(input()) if input_num % 2 == 0: print("#{} Even".format(i+1)) elif input_num % 2 == 1: print("#{} Odd".format(i+1)) SOMJANG/CODINGTEST_PRACTICE 1일 1문제 since 2020.02.07. Contribute to SOMJA..
1일 1문2제 108일차! 오늘의 문제는 SW Expert Academy 세상의 모든 팰린드롬 입니다. SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com Solution def check_palindrome(string): isPalindrome = "Exist" last_index = len(string) - 1 for i in range(len(string) // 2): if string[i] != string[last_index - i]: isPalindrome = "Not exist" break return isPalindrome def change_string(string): string = list(s..
1일 1문제 107일차! 오늘의 문제는 백준의 오르막 수 입니다. 11057번: 오르막 수 오르막 수는 수의 자리가 오름차순을 이루는 수를 말한다. 이때, 인접한 수가 같아도 오름차순으로 친다. 예를 들어, 2234와 3678, 11119는 오르막 수이지만, 2232, 3676, 91111은 오르막 수가 아니다. 수� www.acmicpc.net Solution inputNum = int(input()) nc = [[0]*10 for _ in range(inputNum+1)] ans, mod = 0, 10007 for i in range(0, 10): nc[1][i] = 1 for i in range(2, inputNum+1): nc[i][0] = nc[i-1][0] for j in range(1, 10..
1일 1문제 106일차! 오늘의 문제는 SW Expert Academy 새샘이의 7-3-5 게임입니다. SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com Solution from itertools import combinations T = int(input()) for i in range(T): numbers = list(set(map(int, input().split(' ')))) comb = combinations(numbers, 3) comb_sum = [sum(cmb) for cmb in comb] comb_sum = list(set(comb_sum)) comb_sort = sorted(comb_sum, ..
1일 1문제 105일차! 오늘의 문제는 삼성 SW Expert 아카데미의 두가지 빵의 딜레마 입니다. SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com Solution T = int(input()) for i in range(T): A, B, C = map(int, input().split()) max_bread = 0 min_price = min(A, B) max_bread = C // min_price print("#{} {}".format(i+1, max_bread)) SOMJANG/CODINGTEST_PRACTICE 1일 1문제 since 2020.02.07. Contribute to SOMJANG/COD..
Given a non-empty array of digits representing a non-negative integer, plus one to the integer. The digits are stored such that the most significant digit is at the head of the list, and each element in the array contain a single digit. You may assume the integer does not contain any leading zero, except the number 0 itself. Example 1: Input: [1,2,3] Output: [1,2,4] Explanation: The array repres..
[문자] 청와대 청원 : 청원의 주제가 무엇일까? 출처 : DACON - Data Science Competition dacon.io 그동안 Elasticsearch를 활용하여 검색 시스템을 개발하면서 자연어처리에 대해서 공부를 좀 소홀히 한 느낌이있어 다시 기존에 공부했던 내용을 리마인드 시킬 겸! 데이콘에서 교육용으로 열려있는 청와대 청원 분류 문제를 풀어보기로 했습니다. 이 문제는 청와대 청원이 0 : 인권 / 성평등 | 1 : 문화 / 예술 / 체육 / 언론 | 2 : 육아 / 교육 이 세가지 중 어떤 카테고리에 속하는지 분류를 하면되는 문제입니다. 모든 과정은 Google Colab의 GPU 환경에서 진행하였습니다. 먼저 pandas의 read_csv로 데이터를 불러와 각 카테고리마다 데이터가 ..
Implement int sqrt(int x). Compute and return the square root of x, where x is guaranteed to be a non-negative integer. Since the return type is an integer, the decimal digits are truncated and only the integer part of the result is returned. Example 1: Input: 4 Output: 2 Example 2: Input: 8 Output: 2 Explanation: The square root of 8 is 2.82842..., and since the decimal part is truncated, 2 is ..
Implementatoiwhich converts a string to an integer. The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical digits as possible, and interprets them as a numerical value. The string can contain additional characters after ..
1일 1문제 101일차! 오늘이 문제는 2xn 타일링 2입니다. 11727번: 2×n 타일링 2 2×n 직사각형을 1×2, 2×1과 2×2 타일로 채우는 방법의 수를 구하는 프로그램을 작성하시오. 아래 그림은 2×17 직사각형을 채운 한가지 예이다. www.acmicpc.net Solution n = int(input()) def answer(n): if n == 1: fiboNum = 1 elif n == 2: fiboNum = 3 elif n >= 3: fibo = [0] * (n) fibo[0] = 1 fibo[1] = 3 for i in range(2, n): fibo[i] = (fibo[i-1] + fibo[i-2] + fibo[i-2]) % 10007 fiboNum = fibo[n-1] ret..
1일 1문제! 오늘은 1일 1문제의 100일차!!!!!!! 백준의 계단 오르기입니다. 2579번: 계단 오르기 계단 오르기 게임은 계단 아래 시작점부터 계단 꼭대기에 위치한 도착점까지 가는 게임이다. 과 같이 각각의 계단에는 일정한 점수가 쓰여 있는데 계단을 밟으면 그 계단에 쓰여 있는 점 www.acmicpc.net Solution inputNum = int(input()) stairScores = [] for i in range(inputNum): inputScore = int(input()) stairScores.append(inputScore) maxScore = [0] * inputNum for i in range(inputNum): if i == 0: maxScore[0] = stairScor..
1일 1문제 99일차! 오늘의 문제는 백준의 문자열 분석입니다. 10820번: 문자열 분석 문자열 N개가 주어진다. 이때, 문자열에 포함되어 있는 소문자, 대문자, 숫자, 공백의 개수를 구하는 프로그램을 작성하시오. 각 문자열은 알파벳 소문자, 대문자, 숫자, 공백으로만 이루어져 있 www.acmicpc.net Solution import re while True: try: string = input() except: break if len(string) == 0: break elif len(string) != 0: somunja = re.findall('[a-z]', string) daemunja = re.findall('[A-Z]', string) sutja = re.findall('[0-9]', s..
docker-compose.yml 파일을 만들고 난 이후 docker-compose up -d 명령어를 통해서 실행하려고 하니 bash: docker-compose: command not found docker-compose 명령어를 찾을 수 없다고 나와 찾아보니 docker 설치 이외에 추가로 설치를 해주어야한다고 되어있어 설치방법을 적어보려합니다. 설치 명령어 sudo curl -L https://github.com/docker/compose/releases/download/1.21.0/docker-compose-`uname -s`-`uname -m` | sudo tee /usr/local/bin/docker-compose > /dev/null 위의 명령어를 통해서 docker-compose를 다운로..
1일 1문제! 98일차! 오늘의 문제는 백준의 큐 입니다. 10845번: 큐 첫째 줄에 주어지는 명령의 수 N (1 ≤ N ≤ 10,000)이 주어진다. 둘째 줄부터 N개의 줄에는 명령이 하나씩 주어진다. 주어지는 정수는 1보다 크거나 같고, 100,000보다 작거나 같다. 문제에 나와있지 �� www.acmicpc.net Solution my_queue = [] command_list = [] num = input() for i in range(int(num)): command = input() command_list.append(command) for command in command_list: cmd = command.split() if cmd[0] == 'push': my_queue.append(..
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a string and make this conversion given a number of rows: string convert(string s, int numRows); Example 1: Input: s = "PA..
1일 1문제 96일차! 오늘의 문제는 백준의 듣보잡입니다. 1764번: 듣보잡 첫째 줄에 듣도 못한 사람의 수 N, 보도 못한 사람의 수 M이 주어진다. 이어서 둘째 줄부터 N개의 줄에 걸쳐 듣도 못한 사람의 이름과, N+2째 줄부터 보도 못한 사람의 이름이 순서대로 주어진다. �� www.acmicpc.net Solution N, M = map(int, input().split()) people_no_hear = [] people_no_look = [] for i in range(N): name = str(input()) people_no_hear.append(name) for i in range(M): name = str(input()) people_no_look.append(name) no_hear..
Elasticsearch가 설치된 서버와 api를 실행할 서버가 같으면서 개발한 API 에서 Elasticsearch를 연결할 때 es_client = Elasticsearch("http://localhost:9200") 위와 같이 Python과 Elasticsearh 라이브러리를 활용하여 연결하는 경우 Python과 Flask를 활용하여 개발한 API를 담은 이미지를 만들고 docker run -it -d --name api_contatiner -p 5000:5000 api_image 위의 명령어를 활용하여 container로 실행한 후 http://localhost:5000/search?query=%EC%95%88%EB%85%95 query를 보내 호출을 하려고하면 app.py가 실행되면서 Elast..
Given a string, find the length of the longest substring without repeating characters. Example 1: Input: "abcabcbb" Output: 3 Explanation: The answer is "abc", with the length of 3. Example 2: Input: "bbbbb" Output: 1 Explanation: The answer is "b", with the length of 1. Example 3: Input: "pwwkew" Output: 3 Explanation: The answer is "wke", with the length of 3. Note that the answer must be a su..
1일 1문제 94일차! 오늘의 문제는 가장 긴 증가하는 부분수열입니다. 11053번: 가장 긴 증가하는 부분 수열 수열 A가 주어졌을 때, 가장 긴 증가하는 부분 수열을 구하는 프로그램을 작성하시오. 예를 들어, 수열 A = {10, 20, 10, 30, 20, 50} 인 경우에 가장 긴 증가하는 부분 수열은 A = {10, 20, 10, 30, 20, 50} 이 www.acmicpc.net Solution inputNum = int(input()) inputNums = input() inputNums = inputNums.split() inputNums = [int(num) for num in inputNums] nc = [0] * (inputNum) maxNum = 0 for i in range(0,..
1일 1문제 93일차! 오늘의 문제는 백준의 ROT13입니다. 11655번: ROT13 첫째 줄에 알파벳 대문자, 소문자, 공백, 숫자로만 이루어진 문자열 S가 주어진다. S의 길이는 100을 넘지 않는다. www.acmicpc.net Solution word_s = input() rot13keyValue = {'a':'n', 'b':'o', 'c':'p', 'd':'q', 'e':'r', 'f':'s', 'g':'t', 'h':'u', 'i':'v', 'j':'w', 'k':'x', 'l':'y', 'm':'z', 'n':'a', 'o':'b', 'p':'c', 'q':'d', 'r':'e', 's':'f', 't':'g', 'u':'h', 'v':'i', 'w':'j', 'x':'k', 'y':'l'..
1일 1문제 92일차! 오늘의 문제는 백준의 에디터 입니다. 1406번: 에디터 문제 한 줄로 된 간단한 에디터를 구현하려고 한다. 이 편집기는 영어 소문자만을 기록할 수 있는 편집기로, 최대 600,000글자까지 입력할 수 있다. 이 편집기에는 '커서'라는 것이 있는데, 커서는 문장의 맨 앞(첫 번째 문자의 왼쪽), 문장의 맨 뒤(마지막 문자의 오른쪽), 또는 문장 중간 임의의 곳(모든 연속된 두 문자 사이)에 위치할 수 있다. 즉 길이가 L인 문자열이 현재 편집기에 입력되어 있으면, 커서가 위치할 수 있는 곳은 L+1가지 경우가 www.acmicpc.net Solution import sys from collections import deque class Editor: def __init__(self..
1일 1문제! 91일차! 91일차의 문제는 백준의 괄호입니다. 9012번: 괄호 문제 괄호 문자열(Parenthesis String, PS)은 두 개의 괄호 기호인 ‘(’ 와 ‘)’ 만으로 구성되어 있는 문자열이다. 그 중에서 괄호의 모양이 바르게 구성된 문자열을 올바른 괄호 문자열(Valid PS, VPS)이라고 부른다. 한 쌍의 괄호 기호로 된 “( )” 문자열은 기본 VPS 이라고 부른다. 만일 x 가 VPS 라면 이것을 하나의 괄호에 넣은 새로운 문자열 “(x)”도 VPS 가 된다. 그리고 두 VPS x 와 y를 접합(conc www.acmicpc.net Solution case = int(input()) result = [] for i in range(case): gwalhos = list(in..
Python과 bulk API를 활용하여 인덱싱을 하던 중 elasticsearch.exceptions.ConnectionTimeout: ConnectionTimeout caused by - ReadTimeoutError(HTTPConnectionPool(host='localhost', port=9200): Read timed out. (read timeout=10)) 위와 같은 오류가 나면서 중간에 멈추는 현상이 계속 생겨 14만건의 데이터를 인덱싱하여야하지만 계속 3만건에서 멈추는 현상이 있었습니다. 이 문제는 연결 시간을 초과했을때 발생한다고 합니다. 해당하는 변수값은 es_client = ElasticSearch("http://localhost:9200") Elasticsearch를 연결하는 위의..
1일 1문제 90일차! 오늘의 문제는 GCD 합 입니다. 9613번: GCD 합 문제 양의 정수 n개가 주어졌을 때, 가능한 모든 쌍의 GCD의 합을 구하는 프로그램을 작성하시오. 입력 첫째 줄에 테스트 케이스의 개수 t (1 ≤ t ≤ 100)이 주어진다. 각 테스트 케이스는 한 줄로 이루어져 있다. 각 테스트 케이스는 수의 개수 n (1 0: a = b b = mod mod = a%b return ..
Flask로 API를 만들던 중 (venv) (base) DongHyunui-MacBook-Pro:ElasticsearchAPI donghyunjang$ python3 app.py * Serving Flask app "app" (lazy loading) * Environment: production WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Debug mode: on Traceback (most recent call last): File "app.py", line 97, in app.run(host='0.0.0.0', debug=Tr..