일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- baekjun
- markdown
- adjacentElementsProduct
- C++
- 2750
- codesingal
- centuryFromYear
- flask
- 백준
- Daily Commit
- 파이썬 포렌식
- 피보나치 수
- collections.deque
- 10953
- shapeArea
- 2015 봄학기 알고리즘
- matrixElementsSum
- Counting cells in a blob
- data_structure
- Numpy
- cpp
- recursion
- 파이썬머신러닝완벽가이드
- codesignal
- 수 정렬하기
- til
- almostIncreasingSequence
- Sequential Search
- All Longest Strings
- Python
- Today
- Total
목록분류 전체보기 183
Introfor
손익분기점 : 총 비용과 총 소득이 동등한 지점을 의미 고정비용 : A, 가변비용 : B, 노트북 가격 : C, 노트북 판매 수 k 손익분기점 = (C - B)k - A 손익분기점이 0일 때 A+Bk = Ck로 k = A/(C-B)된다. 문제에서 최초 수익이 발생하는 판매량을 나타내는 것으로 k = A/(C-B)+1이 된다. 12345678910def solution(): A, B, C = map(int, input().split()) if B >= C: return -1 else: return int(A/(C-B)+1) res = solution()print(res)cs
바로 나오는 단어를 통해 정렬한 단어가 입력 받은 단어와 같은지 비교해서 풀었는데.. 찾아보니 이렇게 푼 사람들이 많았다 1 2 3 4 5 6 7 8 9 10 11 def solution(): res_ = 0 for i in range(int(input())): word = input() if list(word) == sorted(word, key=word.find): res_ += 1 return res_ res = solution() print(res) Colored by Color Scripter cs 이 방법 말고 다른 방법을 생각해봐야겠다. 다른 코드 너무 단순하게만 생각했던 것 같다. 누구나 쉽게 단어의 한 알파벳과 그 다음 알파벳을 비교하는 방식으로 생각하기 쉽다. 하지만 이 방식과 다르게 ..
1일 1코딩 12345678910def solution(): croatia_alpha = ['c=', 'c-', 'dz=', 'd-', 'lj', 'nj', 's=', 'z='] string = input() for i in croatia_alpha: string = string.replace(i, '0') return len(string) res = solution()print(res)Colored by Color Scriptercs
지금 내 수준에서 쉽게 푸는 문제들은 그냥 너무 쉬운 문제들... 1 2 3 4 5 6 def solution(): return max(list(map(int, input()[::-1].split()))) res = solution() print(res) Colored by Color Scripter cs 다른 사람 코드 위 코드와 같은 시간이 걸린다,, 64ms 1 2 3 4 5 6 7 8 9 a, b = input().split() a = int(a[::-1]) b = int(b[::-1]) if a > b : print(a) else : print(b) cs
입력 받은 string의 양쪽 공백을 없애고, 공백을 기준으로 분리 한 후 리스트의 개수를 반환 1 2 3 4 5 6 def solution(): return len(input().strip().split()) res = solution() print(res) cs 다른 사람 코드 문장을 입력 받고, 공백으로 나누는 것은 동일. 3번째 줄에서 공백이 아닌 문자들을 분류 후 다음 줄에서 개수 반환 1 2 3 4 string = input("") words = string.split(" ") words = [w for w in words if w != ""] print(len(words)) Colored by Color Scripter cs
결과를 대문자로 나타내서 편의상 입력 받은 문자열을 대문자로 변환한다. 알파벳 개수를 세기 위한 리스트 변수를 생성하고, 이 리스트에 문자열에 대한 알파벳 개수를 넣어준다. 그 다음 최대값 개수를 계산하고 그에 따라 반환값을 지정한다. 1 2 3 4 5 6 7 8 9 10 11 12 def solution(): string = input().upper() alpha_cnt = [] for i in set(string): alpha_cnt.append(string.count(i)) max_loc = [index for index, value in enumerate(alpha_cnt) if value == max(alpha_cnt)] if len(max_loc) > 1: return '?' else: ret..
알파벳을 리스트에 담아 입력받은 단어가 리스트에 존재한다면 존재값을 넣고 없을 경우 -1을 넣습니다. 1 2 3 4 5 6 7 8 9 10 def solve(): alphabet = list(map(chr, range(97, 123))) string = input() for i in range(len(alphabet)): alphabet[i] = string.find(alphabet[i]) return alphabet res = solve() print(*res) Colored by Color Scripter cs 다른 사람의 코드 1print(*map(input().find, map(chr, range(97, 123))), sep=' ')cs