일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 백준1476
- 백준
- 새싹
- 25083
- safari world
- 파이썬
- 10430
- 디버그심볼
- 18108
- baekjoon
- Counting The number
- 기본메신저
- 코틀린
- 백준3085
- 꼬마 정민
- 백준1107
- kotlin
- 사파리 월드
- 1330
- debugSymbolLevel
- BitMasking
- 브루트포스
- Android
- 10807
- dp
- 2525
- 개수 세기
- 10926
- Class Delegation
- PreferenceManager
- Today
- Total
목록전체 글 (100)
세상을 더 좋게
인터페이스는 클래스를 통해 구현된다. Example1. Runtime polymorphism 구현하기 open class Instrument { open fun play() { println("Instrument.play()") } } class Wind : Instrument() { override fun play() { println("Wind.play()") } } class Stringed : Instrument() { override fun play() { println("Stringed.play()") } } class Percussion : Instrument() { override fun play() { println("Percussion.play()") } } fun main() { v..
안드로이드에서 Dispatchers.Main을 사용하려 하면 에러가 발생되는 현상이 나타납니다. 이를 해결하기 위해서는 gradle에 implementaition 하나를 추가하면 됩니다. implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9'
PreferenceManager.getDefaultSharedPreferences(context).edit() .putString(KEY_AUTH_TOKEN, token) .apply() 와 같은 구문을 작성하려니 돌연히 PreferenceManager가 deprecated 되었다고 알려준다. 찾아보니 AndroidX Preference Library가 대체되어 새로운 PreferenceManager를 사용하면 되는 것이었다. 이를 위해서는 implementation 'androidx.preference:preference:1.1.1' gradle에 위와 같이 implementation 하나만 추가해주고 예전처럼 사용하면 된다.
https://www.acmicpc.net/problem/1107 1107번: 리모컨 첫째 줄에 수빈이가 이동하려고 하는 채널 N (0 ≤ N ≤ 500,000)이 주어진다. 둘째 줄에는 고장난 버튼의 개수 M (0 ≤ M ≤ 10)이 주어진다. 고장난 버튼이 있는 경우에는 셋째 줄에는 고장난 버튼 www.acmicpc.net import sys input = sys.stdin.readline target = int(input()) n = int(input()) broken = list(map(int, input().split())) # 방향키 이동 min_count = abs(100-target) # 50만의 범위이기에 넉넉히 두배인 100만으로 하였다. broken키가 있으면 범위가 늘어나기 때문 f..
https://www.acmicpc.net/problem/1476 1476번: 날짜 계산 준규가 사는 나라는 우리가 사용하는 연도와 다른 방식을 이용한다. 준규가 사는 나라에서는 수 3개를 이용해서 연도를 나타낸다. 각각의 수는 지구, 태양, 그리고 달을 나타낸다. 지구를 나타 www.acmicpc.net e, s, m = map(int, input().split()) cnt = 1 i, j, k = 1, 1, 1 while True: if i == e and j == s and k == m: break i+=1 ; j+=1 ; k+=1 ; cnt+=1 ; if i == 16: i = 1 if j == 29: j = 1 if k == 20: k = 1 print(cnt) Point 일단 범위가 15, 2..
https://www.acmicpc.net/problem/3085 3085번: 사탕 게임 예제 3의 경우 4번 행의 Y와 C를 바꾸면 사탕 네 개를 먹을 수 있다. www.acmicpc.net import sys input = sys.stdin.readline def check(arr): n = len(arr) answer = 1 for i in range(n): # 열 체크 cnt=1 for j in range(1, n): if arr[i][j] == arr[i][j-1]: cnt +=1 else: cnt = 1 if cnt > answer: answer = cnt # 행 체크 cnt = 1 for j in range(1, n): if arr[j][i] == arr[j-1][i]: cnt +=1 els..
https://www.acmicpc.net/problem/2309 2309번: 일곱 난쟁이 아홉 개의 줄에 걸쳐 난쟁이들의 키가 주어진다. 주어지는 키는 100을 넘지 않는 자연수이며, 아홉 난쟁이의 키는 모두 다르며, 가능한 정답이 여러 가지인 경우에는 아무거나 출력한다. www.acmicpc.net list = [int(input()) for i in range(9)] total = sum(list) for i in range(9): for j in range(i+1, 9): if total - (list[i] + list[j]) == 100: num1, num2 = list[i], list[j] list.remove(num1) list.remove(num2) list.sort() for i in r..

https://www.acmicpc.net/problem/2133 2133번: 타일 채우기 3×N 크기의 벽을 2×1, 1×2 크기의 타일로 채우는 경우의 수를 구해보자. www.acmicpc.net n = int(input()) def sol(n): if n % 2 != 0: return 0 else: dp = [0] * (n + 1) dp[0] = 1 dp[2] = 3 for i in range(4, n + 1): dp[i] = dp[i-2] * 3 for j in range(i-4, -1, -2): dp[i] += dp[j] * 2 return dp[n] print(sol(n)) Point 타일문제로서 규칙을 먼저 찾아보면 홀수는 성립되지 않고 짝수만 성립된다는 것을 우선 알 수 있다. 그리고 n=..