본문 바로가기
반응형

전체 글 목록573

[백트래킹/파이썬] 백준 2239번: 스도쿠 / 골드 4 https://www.acmicpc.net/problem/2580(문제 동일) 2580번: 스도쿠 스도쿠는 18세기 스위스 수학자가 만든 '라틴 사각형'이랑 퍼즐에서 유래한 것으로 현재 많은 인기를 누리고 있다. 이 게임은 아래 그림과 같이 가로, 세로 각각 9개씩 총 81개의 작은 칸으로 이루 www.acmicpc.net https://www.acmicpc.net/problem/2239 2239번: 스도쿠 스도쿠는 매우 간단한 숫자 퍼즐이다. 9×9 크기의 보드가 있을 때, 각 행과 각 열, 그리고 9개의 3×3 크기의 보드에 1부터 9까지의 숫자가 중복 없이 나타나도록 보드를 채우면 된다. 예를 들어 다 www.acmicpc.net table = [] for _ in range(9): table.ap.. 2021. 8. 5.
[안드로이드] 커스터마이징에 유용한 버튼 참고자료: https://boilerplate.tistory.com/51 버튼에 Ripple 효과 적용하기 Android 버튼에 Ripple Effect를 주는 방법에 대해서 알아보도록 하겠습니다. 먼저 결론부터 말해보자면, 2가지 방법을 추천합니다. 1) MaterialButton, MaterialCardView 를 사용하는 방법 (Android Support Desi.. boilerplate.tistory.com 일반 버튼보다 MaterialButton, MaterialCardView를 쓰는 것이 디자인 커스터마이징에 더 유용하다! 2021. 8. 4.
[안드로이드] 뷰페이저2 - 옆 프래그먼트 미리 보여주기 뷰페이저2를 xml 상에서 설정하고 id를 pager로 설정해준 상태다. val pagerWidth = resources.getDimensionPixelOffset(R.dimen.pagerWidth) val screenWidth = resources.displayMetrics.widthPixels val pagerPadding = ((screenWidth - pagerWidth ) * 0.5).toInt() val offsetPx = ((screenWidth - pagerWidth)* 0.25).toInt() pager.clipToPadding = false pager.clipChildren = false pager.setPadding(pagerPadding, 0, pagerPadding, 0) page.. 2021. 8. 4.
[ 최소 신장 트리 ] 백준 1922번: 네트워크 연결 / 골드 4 https://www.acmicpc.net/problem/1922 1922번: 네트워크 연결 이 경우에 1-3, 2-3, 3-4, 4-5, 4-6을 연결하면 주어진 output이 나오게 된다. www.acmicpc.net def find(parent, x): if parent[x] != x: parent[x] = find(parent, parent[x]) return parent[x] def union(parent, a, b): a = find(parent, a) b = find(parent, b) if a < b: parent[b] = a else: parent[a] = b import sys n = int(input()) m = int(input()) parent = [0]*(n+1) edges = .. 2021. 7. 29.
[투 포인터] 백준 2467번: 용액 / 골드 5 https://www.acmicpc.net/problem/2467 2467번: 용액 첫째 줄에는 전체 용액의 수 N이 입력된다. N은 2 이상 100,000 이하의 정수이다. 둘째 줄에는 용액의 특성값을 나타내는 N개의 정수가 빈칸을 사이에 두고 오름차순으로 입력되며, 이 수들은 모두 - www.acmicpc.net n = int(input()) lst = list(map(int, input().split())) if lst[0] >= 0: # all elem is positive print(lst[0], lst[1]) quit() if lst[-1] 0: right -= 1 new = abs(lst[left] + lst[right]) if new 2021. 7. 29.
[구현] 백준 2638번: 치즈 / 골드 4 https://www.acmicpc.net/problem/2638 2638번: 치즈 첫째 줄에는 모눈종이의 크기를 나타내는 두 개의 정수 N, M (5 ≤ N, M ≤ 100)이 주어진다. 그 다음 N개의 줄에는 모눈종이 위의 격자에 치즈가 있는 부분은 1로 표시되고, 치즈가 없는 부분은 0으로 www.acmicpc.net x_lim, y_lim = map(int, input().split()) # count the initial num of cheese cheese = 0 graph = [] for i in range(x_lim): row = list(map(int, input().split())) graph.append(row) for j in range(y_lim): if row[j] == 1: c.. 2021. 7. 28.
반응형