분류 전체보기 299

[python/14681]사분면 고르기

https://www.acmicpc.net/problem/14681 14681번: 사분면 고르기 문제 흔한 수학 문제 중 하나는 주어진 점이 어느 사분면에 속하는지 알아내는 것이다. 사분면은 아래 그림처럼 1부터 4까지 번호를 갖는다. "Quadrant n"은 "제n사분면"이라는 뜻이다. 예를 들어, 좌표가 (12, 5)인 점 A는 x좌표와 y좌표가 모두 양수이므로 제1사분면에 속한다. 점 B는 x좌표가 음수이고 y좌표가 양수이므로 제2사분면에 속한다. 점의 좌표를 입력받아 그 점이 어느 사분면에 속하는지 알아내는 프로그램을 작성하시오. 단, x좌표 www.acmicpc.net 더보기 내 코드 제1 사분면 : (양수, 양수) 제2 사분면 : (음수, 양수) 제3 사분면 : (음수, 음수) 제4 사분면 :..

알고리즘/백준 2020.03.18

[python]CamelCase Method

https://www.codewars.com/kata/587731fda577b3d1b0001196/train/python Codewars: Train your coding skills Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com 문자열에서 각 단어들의 맨 알파벳을 대문자로 변경 후 스페이스 없애는 문제이다. 더보기 title()이라는 것을 사용하면 각 단어의 첫 글자를 대문자로 변경해준다. replace("old", "new")라는 것을 사용하면 old를 new로 바꾸어준다. 이 두 가지를 ..

[python]Bouncing Balls

https://www.codewars.com/kata/5544c7a5cb454edb3c000047/train/python Codewars: Train your coding skills Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com 한 아이가 h 높이에서 공을 창문으로 던질 때 공은 h 곱하기 bounce만큼 튀어 오른다. 아이의 엄마가 window에서 볼 때 엄마는 공이 지나가는 것을 몇 번이나 보는지가 문제이다. 더보기 변수 h, bounce와 window가 각 조건을 만족하지 않으면 -1을..

[python]Simple Pig Latin

https://www.codewars.com/kata/520b9d2ad5c005041100000f/train/python Codewars: Train your coding skills Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com 문자열에서 단어의 앞 알파벳을 단어의 뒤로 옮긴 뒤 'ay'를 덧 붙여서 출력하는 문제이다. 예) 'Pig' -> 'igPay' 더보기 내 코드 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 # My Code def pig_it(text)..

[python]Highest Scoring Word

https://www.codewars.com/kata/57eb8fcdf670e99d9b000272/train/python Codewars: Train your coding skills Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com 문자열에서 합이 가장 큰 단어 찾는 문제이다. 더보기 내 코드 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 # My Code def high(x): answer_ = [] sum_ = 0 for i in x: if ..

[python]Build Tower

https://www.codewars.com/kata/576757b1df89ecf5bd00073b/train/python Codewars: Train your coding skills Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com 별로 탑을 쌓아서 출력하는 문제이다. 문제를 풀기 위해 필요한 것 1. 스페이스와 *을 조합 수식 찾기 더보기 스페이스와 *의 조합 스페이스와 *이 눈으로 보기에 적합하지 않아서 스페이스를 X, *를 O로 바꾸어서 풀어보았다. 한 변의 X 수와 O의 수를 구해 보았다..

[python]Equal Sides Of An Array

https://www.codewars.com/kata/5679aa472b8f57fb8c000047/train/python Codewars: Train your coding skills Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com 주어진 배열에서 한 개의 인덱스를 기준으로 왼쪽과 오른쪽의 합이 같은 인덱스를 찾는 문제이다. 문제를 풀기 위해 필요한 것 1. 합 구하기 2. 왼쪽과 오른쪽 비교 더보기 합 구하기 : sum(구하고 싶은 값들의 집합) 왼쪽과 오른쪽 비교 : if left == ri..

[python]Shortest Word

https://www.codewars.com/kata/57cebe1dc6fdc20c57000ac9/train/python Codewars: Train your coding skills Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com 문자열에서 가장 짧은 단어의 길이를 구하는 문제이다. 문제를 풀기 위해 필요한 것 1. 문자열을 단어 별로 자르기 2. 단어의 길이 구하기 3. 단어들의 최솟값 찾기 더보기 문자열을 단어 별로 자르기 : 문자열.split() 단어의 길이 구하기 : len(문자열) 단..

[python]Counting Duplicates

https://www.codewars.com/kata/54bf1c2cd5b56cc47f0007a1/train/python Codewars: Train your coding skills Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com 문자열에서 대소문자 상관없이 2개 이상 반복되는 문자의 개수를 찾는 문제이다. 문제를 풀기 위해 필요한 것 1. 문자열을 대문자나 소문자로 변형 2. 중복되는 문자 제거 3. 문자열에 존재하는 문자 세기 더보기 문자열 대문자 : 문자열.upper() 문자열 소문자 :..

728x90