일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Python
- Daily Commit
- matrixElementsSum
- 파이썬머신러닝완벽가이드
- Sequential Search
- codesingal
- 피보나치 수
- 파이썬 포렌식
- shapeArea
- codesignal
- flask
- 10953
- data_structure
- markdown
- cpp
- adjacentElementsProduct
- 백준
- 수 정렬하기
- til
- 2750
- recursion
- collections.deque
- 2015 봄학기 알고리즘
- Counting cells in a blob
- centuryFromYear
- baekjun
- All Longest Strings
- Numpy
- C++
- almostIncreasingSequence
- Today
- Total
Introfor
지금 내 수준에서 쉽게 푸는 문제들은 그냥 너무 쉬운 문제들... 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..