일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- shapeArea
- cpp
- Numpy
- codesignal
- almostIncreasingSequence
- All Longest Strings
- Python
- 피보나치 수
- data_structure
- Sequential Search
- flask
- 파이썬머신러닝완벽가이드
- 2015 봄학기 알고리즘
- adjacentElementsProduct
- Counting cells in a blob
- Daily Commit
- 10953
- baekjun
- 백준
- markdown
- recursion
- codesingal
- 파이썬 포렌식
- 2750
- centuryFromYear
- matrixElementsSum
- 수 정렬하기
- til
- C++
- collections.deque
- Today
- Total
Introfor
입력 받은 3개의 수를 오름차순 정렬하고 set()을 이용하여 개수를 통해 문제를 풀었다. 저번에 주사위 네개를 풀어서 같은 방식으로 풀었다. 1 2 3 4 5 6 7 8 9 10 11 12 def solution() -> int: dice = sorted(map(int, input().split())) if len(set(dice)) == 1: return 10000 + dice[0] * 1000 if len(set(dice)) == 3: return dice[2] * 100 for i in range(2): if dice[i] == dice[i+1]: return 1000+dice[i]*100 res = solution() print(res) Colored by Color Scripter cs
소수는 약수로 1과 자기 자신만 가지는 수를 의미. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 def solution(): int(input()) nums = list(map(int, input().split())) res = 0 for i in nums: cnt = 0 for j in range(1, i+1): if not i % j: cnt += 1 if cnt == 2: res += 1 return res res = solution() print(res) Colored by Color Scripter cs
문자열 - 문자열을 표현하는 타입 String은 immutable 속성 가짐 - String 리터럴(""로 둘러친 0개 문자 이상의 문자열) - 인덱스로 참조 가능 -> 첫 글자 참조 경우, "Kotlin"[0] String을 위한 편리한 메서드 및 프로퍼티 - length : 문자열의 크기를 반환하는 프로퍼티 -> str.length - capitalize : 첫번째 문자만 대문자로 변환하는 메서드 -> str.capitalize() - isBlank : 공백문자 또는 그런 문자로 구성된 문자열에 대해 true 반환 -> str.isBlank() 문자열 처리의 단순한 방법 : + 연산자 사용 -> "Hello, " + name + "!" 문자열 템플릿 처리 : $ 연산자 사용 -> "Hello. ${n..