일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- jvm 작동 원리
- 안드로이드 유닛 테스트 예시
- 2022 플러터 안드로이드 스튜디오
- 2022 플러터 설치
- 자바 다형성
- 안드로이드 유닛 테스트
- ar vr 차이
- 안드로이드 라이선스
- ANR이란
- 큐 자바 코드
- 서비스 쓰레드 차이
- 스택 자바 코드
- android retrofit login
- jvm이란
- 안드로이드 유닛테스트란
- 안드로이드 라이선스 종류
- 안드로이드 os 구조
- rxjava hot observable
- Rxjava Observable
- 멤버변수
- 스택 큐 차이
- rxjava disposable
- 안드로이드 레트로핏 crud
- 안드로이드 레트로핏 사용법
- 플러터 설치 2022
- 클래스
- 객체
- android ar 개발
- 서비스 vs 쓰레드
- rxjava cold observable
- Today
- Total
목록분류 전체보기 (1024)
나만을 위한 블로그

이 문제도 브루트 포스 알고리즘을 써서 풀 수 있다. 카드 3장의 합이 M 이하면서 M에 가장 가까운 값을 찾아야 한다.반복문 3개를 사용해서 카드를 3개씩 선택하는 경우를 구현할 수 있다. fun main() { val (N, M) = readln().split(" ").map { it.toInt() } val cards = readln().split(" ").map { it.toInt() } var maxSum = 0 for (i in 0 until N) { for (j in i + 1 until N) { for (k in j + 1 until N) { val sum = cards[i] + cards[j] + cards[..

1을 포함한 벌집은 6개의 벌집이 감싸고, 그 밖의 벌집은 12개가 감싼다. 즉 벌집의 방들을 계층화하면 아래와 같다고 볼 수 있다. 1층 : 중앙 1개의 방2층 : 방 6개(2~7)3층 : 방 12개(8~19)4층 : 방 18개(20~37) 이런 식으로 n층의 방은 몇 개인지 구하려면 6n으로 구할 수 있다. 이를 바탕으로 주어진 숫자가 어떤 층에 속하는지 알면 최소 방의 개수를 몇 개나 지나야 하는지 알 수 있다. fun main() { val N = readln().toInt() if (N == 1) { println(1) return } var layer = 1 var maxRoomInLayer = 1 while (N > ma..

숫자가 주어지면 그 숫자의 가장 작은 생성자를 구하는 문제다. 주어진 숫자와 그 숫자의 일, 십, 백의 자리수 숫자를 더해서 분해합은 만들었지만 이후 로직을 짜지 못해서 풀지 못했다.아래는 풀이 코드다. fun main() { val n = readln().toInt() println(findSmallestConstructor(n))}fun findSmallestConstructor(n: Int): Int { for (i in 1 until n) { if (decompositionSum(i) == n) { return i } } return 0}fun decompositionSum(num: Int): Int = num + num..

플러터에서 바텀 시트를 표시하는 함수는 2가지 있다. showBottomSheetshowModalBottomSheet 2가지를 모두 확인해 본다. 아래는 showBottomSheet()의 공식문서다. https://api.flutter.dev/flutter/material/ScaffoldState/showBottomSheet.html showBottomSheet method - ScaffoldState class - material library - Dart APIPersistentBottomSheetController showBottomSheet( WidgetBuilder builder, { Color? backgroundColor, double? elevation, ShapeBorder? shape,..

소수는 1보다 크면서 약수가 1과 자기 자신뿐인 숫자를 말한다. 2번째 입력에서 이 소수의 숫자를 카운트해서 출력하면 된다. fun main() { val N = readln().toInt() val nums = readln().split(" ").map { it.toInt() } var primeCount = 0 for (num in nums) { if (isPrime(num)) { primeCount++ } } println(primeCount)}fun isPrime(x: Int): Boolean { if (x 소수 구하는 로직을 함수로 따로 뺐다. 소수면 true, 소수가 아니면 false를 리턴하는 함수로, 함수 ..

말이 긴데 결국 정리하면 3번 입력의 첫 번째 수(T)를 통해 티셔츠의 최소 묶음 수를 계산3번 입력의 두 번째 수(P)를 통해 펜의 최대 묶음 수를 계산 2가지를 계산해서 println()을 2번 써서 출력하면 된다. 티셔츠는 남아도 되는데 부족하면 안 되고, 펜은 참가자 수에 맞춰 정확하게 준비해야 하는 것에 주의한다. fun main() { val n = readln().toInt() // 총 참가자 수 val sizes = readln().split(" ").map { it.toInt() } // 티셔츠 사이즈별 신청 수 val (T, P) = readln().split(" ").map { it.toInt() } // 티셔츠 묶음, 펜 묶음 크기 var tshir..

피타고라스의 정리만 떠올린다면 어렵지 않게 풀 수 있다. 여러 입력을 받으면서 "0 0 0"을 받으면 프로그램이 종료되게 하는 것에 주의하면 된다. fun main() { while (true) { val list = readln() .split(" ") .map { it.toInt() } .sortedDescending() if (list == listOf(0, 0, 0)) { break } val left = list[0] * list[0] val right = (list[1] * list[1]) + (list[2] * list[2]) if (..

Hero 애니메이션은 안드로이드에서 공유 요소 전환과 같은 효과를 내는 애니메이션이다. Hero 애니메이션의 공식문서부터 먼저 확인한다. https://docs.flutter.dev/ui/animations/hero-animations Hero animationsHow to animate a widget to fly between two screens.docs.flutter.dev한 화면에서 다른 화면으로 이미지를 이동하는 걸 Hero 애니메이션이라 하며 공유 요소 전환이라고도 한다. Hero 위젯을 써서 쉽게 구현할 수 있고 MaterialPageRoute를 써서 새 경로를 지정하면 머티리얼 디자인 모션 사양에 설명된 대로 이미지가 곡선 경로를 따라 날아간다 아래는 플러터 문서에서 링크된 깃허브로 이..

가끔 이런 에러가 뜨면서 코드 내에서 BuildConfig을 사용할 수 없는 경우가 있다.자동 임포트 설정을 하지 않았거나 그 코드에서만 안 된 거라면 임포트해서 쓰면 되지만, 그렇게 해도 안 될 경우 2가지 방법을 쓸 수 있다. 1. app gradle > buildFeatures에 "buildConfig = true" 추가 먼저 앱 수준 gradle 파일의 buildFeatures 블록 안에 buildConfig = "true"를 추가해서 확인해볼 수 있다. buildFeatures { compose = true buildConfig = true} 컴포즈를 사용 중인 프로젝트라면 compose = true는 기본으로 있을 텐데, 그 밑에 그냥 써주면 된다. 레거시 뷰 프로젝트라면 이 블록이..
이 글은 아래의 미디엄 링크를 번역한 포스팅이다. https://proandroiddev.com/the-best-way-to-load-data-in-viewmodels-a112ced54e07 The best way to load data in ViewModelsSimplicity is key. Sadly, it is also one of the hardest things to achieve in software development. Learn how to easily load data in 2024.proandroiddev.com 아래는 수정할 코드다. sealed interface ViewState { data class Success(val text: String, val counter: Int)..