일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 프로그래머스 파이썬
- 자연어처리
- 프로그래머스
- Docker
- Baekjoon
- Kaggle
- gs25
- 맥북
- hackerrank
- 금융문자분석경진대회
- github
- 편스토랑
- SW Expert Academy
- ChatGPT
- programmers
- Real or Not? NLP with Disaster Tweets
- Git
- leetcode
- 백준
- PYTHON
- 코로나19
- 데이콘
- 우분투
- ubuntu
- 파이썬
- 캐치카페
- 더현대서울 맛집
- 편스토랑 우승상품
- AI 경진대회
- dacon
- Today
- Total
목록
반응형
Programming/코딩 1일 1문제 (1013)
솜씨좋은장씨

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..

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..

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..

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..

1일 1문제 90일차! 오늘의 문제는 GCD 합 입니다. 9613번: GCD 합 문제 양의 정수 n개가 주어졌을 때, 가능한 모든 쌍의 GCD의 합을 구하는 프로그램을 작성하시오. 입력 첫째 줄에 테스트 케이스의 개수 t (1 ≤ t ≤ 100)이 주어진다. 각 테스트 케이스는 한 줄로 이루어져 있다. 각 테스트 케이스는 수의 개수 n (1 0: a = b b = mod mod = a%b return ..

1일 1문제 89일차! 오늘의 문제는 백준의 네 수 입니다. 10824번: 네 수 첫째 줄에 네 자연수 A, B, C, D가 주어진다. (1 ≤ A, B, C, D ≤ 1,000,000) www.acmicpc.net Solution A, B, C, D = map(str, input().split()) intAB = int(A+B) intCB = int(C+D) print(intAB + intCB) SOMJANG/CODINGTEST_PRACTICE 1일 1문제 since 2020.02.07. Contribute to SOMJANG/CODINGTEST_PRACTICE development by creating an account on GitHub. github.com

1일 1문제 88일차! 오늘의 문제는 백준의 곱셈입니다. 1629번: 곱셈 첫째 줄에 A, B, C가 빈 칸을 사이에 두고 순서대로 주어진다. A, B, C는 모두 2,147,483,647 이하의 자연수이다. www.acmicpc.net 첫번째 제출 A, B, C = map(int, input().split()) print((A**B) % C) 쉬운문제다! 라고 좋아했는데 엥...? 시간초과 결과를 볼 수 있었습니다. 두번째 제출 A, B, C = map(int, input().split()) print(pow(A, B) % C) 이전에 pow가 ** 보다 빠르다고 했던 것이 기억나서 **를 pow로 바꾸어 도전했지만 여전히 시간초과 결과가 나왔습니다. 세번째 제출 A, B, C = map(int, in..

1일 1문제! 87일차! 오늘의 문제는 백준의 로또 입니다. 6603번: 로또 문제 독일 로또는 {1, 2, ..., 49}에서 수 6개를 고른다. 로또 번호를 선택하는데 사용되는 가장 유명한 전략은 49가지 수 중 k(k>6)개의 수를 골라 집합 S를 만든 다음 그 수만 가지고 번호를 선택하는 것이다. 예를 들어, k=8, S={1,2,3,5,8,13,21,34}인 경우 이 집합 S에서 수를 고를 수 있는 경우의 수는 총 28가지이다. ([1,2,3,5,8,13], [1,2,3,5,8,21], [1,2,3,5,8,34], [1,2 www.acmicpc.net Solution from itertools import combinations while True: input_command = input() i..

1일 1문제 86일차! 오늘의 문제는 프로그래머스의 최댓값과 최솟값 입니다. 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr Solution def solution(s): answer = '' num_list = list(map(int, s.split(' '))) min_num = min(num_list) max_num = max(num_list) answer = str(min_num) + " " + str(max_num) return answer SOMJANG/CODINGTEST_PRACTICE 1일 1문제 since 2020.02.07. Contribu..

1일 1문제 85일차! 오늘의 문제는 백준의 -2진수 입니다. 2089번: -2진수 -2진법은 부호 없는 2진수로 표현이 된다. 2진법에서는 20, 21, 22, 23이 표현 되지만 -2진법에서는 (-2)0 = 1, (-2)1 = -2, (-2)2 = 4, (-2)3 = -8을 표현한다. 10진수로 1부터 표현하자면 1, 110, 111, 100, 101, 11010, 11011, 11000, 11001 등이다. 10진법의 수를 입력 받아서 -2진수를 출력하는 프로그램을 작성하시오. www.acmicpc.net Solution inputNum = int(input()) base = 1 minusBinary = [] if inputNum == 0: print(0) else: while inputNum: i..

1일 1문제 84일차! 오늘의 문제는 프로그래머스의 124 나라의 숫자입니다! 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr Solution def solution(n): answer = "" while n > 0: n, i = divmod(n, 3) if i == 0: n = n - 1 answer = '412'[i] + answer return answer SOMJANG/CODINGTEST_PRACTICE 1일 1문제 since 2020.02.07. Contribute to SOMJANG/CODINGTEST_PRACTICE development by ..

Marie invented a Time Machine and wants to test it by time-traveling to visit Russia on the Day of the Programmer (the 256th day of the year) during a year in the inclusive range from 1700 to 2700. From 1700 to 1917, Russia's official calendar was the Julian calendar; since 1919 they used the Gregorian calendar system. The transition from the Julian to Gregorian calendar system occurred in 1918,..

HackerLand University has the following grading policy: Every student receives a grade in the inclusive range from 0 to 100. Any grade less than 40 is a failing grade. Sam is a professor at the university and likes to round each student's grade according to these rules: If the difference between the grade and the next multiple of 5 is less than 3, round grade up to the next multiple of 5. If the..

1일 1문제 81일차! 오늘의 문제는 백준의 덱 (Deque) 입니다. 10866번: 덱 첫째 줄에 주어지는 명령의 수 N (1 ≤ N ≤ 10,000)이 주어진다. 둘째 줄부터 N개의 줄에는 명령이 하나씩 주어진다. 주어지는 정수는 1보다 크거나 같고, 100,000보다 작거나 같다. 문제에 나와있지 않은 명령이 주어지는 경우는 없다. www.acmicpc.net Solution my_dequeue = [] 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] =..

1일 1문제 80일차 오늘의 문제는 백준의 요세푸스 문제입니다. 1158번: 요세푸스 문제 첫째 줄에 N과 K가 빈 칸을 사이에 두고 순서대로 주어진다. (1 ≤ K ≤ N ≤ 5,000) www.acmicpc.net Solution N, K = map(int, input().split()) circular_list = [] answer = [] for i in range(N): circular_list.append(i+1) popNum = 0 while len(circular_list) >0: popNum = (popNum + (K-1)) % len(circular_list) popElemnet = circular_list.pop(popNum) answer.append(str(popElemnet)) p..

1일 1문제 79일차! 오늘의 문제는 백준의 1로 만들기 입니다. 1463번: 1로 만들기 첫째 줄에 1보다 크거나 같고, 106보다 작거나 같은 정수 N이 주어진다. www.acmicpc.net Solution inputNum = int(input()) arr = [0] * (inputNum + 1) for i in range(1, inputNum + 1): if i == 1: continue values = [] if i % 3 == 0: values.append(arr[i//3] + 1) if i % 2 == 0: values.append(arr[i//2] + 1) values.append(arr[i-1] + 1) arr[i] = min(values) print(str(arr[inputNum])) ..