목록분류 전체보기 (392)
HTD
val dir = File(requireContext().getExternalFilesDir(null).toString() + "/YOUR_DIRECTORY") dir.deleteRecursively() Just use File().deleteRecursively()
fun getUriFromByteArray(byteArray: ByteArray): Uri{ // Set directory val dir = File(requireContext().getExternalFilesDir(null).toString() + "/YOUR_DIR") if(! dir.exists()){ dir.mkdir() } // Create dummy file val file = if(url.endsWith(".mp4")){ File.createTempFile("post_media", ".mp4", dir) }else{ File.createTempFile("post_media", ".webm", dir) } // Write bytes to the file val os = FileOutputStr..
https://www.acmicpc.net/problem/1647 1647번: 도시 분할 계획 첫째 줄에 집의 개수N, 길의 개수M이 주어진다. N은 2이상 100,000이하인 정수이고, M은 1이상 1,000,000이하인 정수이다. 그 다음 줄부터 M줄에 걸쳐 길의 정보가 A B C 세 개의 정수로 주어지는데 A번 집 www.acmicpc.net import sys input = sys.stdin.readline def find(x): if parent[x] == x: return x parent[x] = find(parent[x]) return parent[x] def union(x, y): px, py = find(x), find(y) if px < py: parent[py] = px else: p..
https://www.acmicpc.net/problem/14890 14890번: 경사로 첫째 줄에 N (2 ≤ N ≤ 100)과 L (1 ≤ L ≤ N)이 주어진다. 둘째 줄부터 N개의 줄에 지도가 주어진다. 각 칸의 높이는 10보다 작거나 같은 자연수이다. www.acmicpc.net import sys input = sys.stdin.readline def getPossiblePathCount(): possiblePathCount = 0 # 가로 for i in range(N): isValidPath = True isRunwayPut = [False]*N for j in range(N-1): c, n = heights[i][j], heights[i][j+1] # 같을 경우 if c == n: con..
https://www.acmicpc.net/problem/1520 1520번: 내리막 길 여행을 떠난 세준이는 지도를 하나 구하였다. 이 지도는 아래 그림과 같이 직사각형 모양이며 여러 칸으로 나뉘어져 있다. 한 칸은 한 지점을 나타내는데 각 칸에는 그 지점의 높이가 쓰여 있으 www.acmicpc.net import sys sys.setrecursionlimit(200000) input = sys.stdin.readline dx = [1, -1, 0, 0] dy = [0, 0, 1, -1] def dfs(x, y): # 이미 방문한 적이 있을 경우 if dp[x][y] != -1: return dp[x][y] # Base case if x == M-1 and y == N-1: return 1 # Rec..
https://www.acmicpc.net/problem/1509 1509번: 팰린드롬 분할 세준이는 어떤 문자열을 팰린드롬으로 분할하려고 한다. 예를 들어, ABACABA를 팰린드롬으로 분할하면, {A, B, A, C, A, B, A}, {A, BACAB, A}, {ABA, C, ABA}, {ABACABA}등이 있다. 분할의 개수의 최솟값을 출력하 www.acmicpc.net import sys sys.setrecursionlimit(200000) input = sys.stdin.readline NOT_INITIALIZED, TRUE, FALSE = 0, 1, 2 def getMinCount(): todo = [0] for c in range(input_len+1): nextTodo = [] while..
https://www.acmicpc.net/problem/4386 4386번: 별자리 만들기 도현이는 우주의 신이다. 이제 도현이는 아무렇게나 널브러져 있는 n개의 별들을 이어서 별자리를 하나 만들 것이다. 별자리의 조건은 다음과 같다. 별자리를 이루는 선은 서로 다른 두 별을 일 www.acmicpc.net import sys import math import itertools input = sys.stdin.readline def getDistance(p1, p2): return math.sqrt(((p1[0] - p2[0])**2 + (p1[1] - p2[1])**2)) def find(x): if parent[x] == x: return x px = find(parent[x]) parent[x] ..
https://www.acmicpc.net/problem/1007 1007번: 벡터 매칭 평면 상에 N개의 점이 찍혀있고, 그 점을 집합 P라고 하자. 집합 P의 벡터 매칭은 벡터의 집합인데, 모든 벡터는 집합 P의 한 점에서 시작해서, 또 다른 점에서 끝나는 벡터의 집합이다. 또, P에 속 www.acmicpc.net import sys import itertools input = sys.stdin.readline def getPointsSum(points): xSum, ySum = 0, 0 for x, y in points: xSum += x ySum += y return xSum, ySum if __name__ == '__main__': T = int(input()) for _ in range(T)..
먼저, 프로젝트의 스케일이 상당히 크기도 하고 Client와 Server로 나뉘어 있었기 때문에, waterfall만으로는 정확히 뭐가 필요한지 파악이 힘들었다. 이에 따라 클라이언트와 서버가 너무 따로 노는 느낌이고, 상호간의 피드백도 힘들었다. 이에 따라 애자일 개발론을 적용시켰다. 스프린트를 일주일로 잡고, 하나의 큰 feature 개발을 목표로 두고, 단기 계획을 짜고 개발을 시작했다. 단기적인 작은 목표가 하나 있으니까 개발 속도가 매우 빨라진 것을 알 수 있었다. 아래는 우리 프로젝트의 커밋 인사이트이다. 참고로 스프린트는 7월 12일부터 시작하였다. 그리고 서버와 클라이언트가 모두 한 섹터를 보고 작업을 하다보니 상호간 필요한 요구사항, 버그 리포트, 피드백이 많아졌고 이는 많은 commit..
https://rccode.tistory.com/entry/Kotlin-Set-indent-to-first-line-of-TextView-in-android [Kotlin] Set indent to first line of TextView in android - Description To do so, you should use Span, LeadingMarginSpan. In a nutshell, Span is used to set text style in detail, and LeadingMarginSpan is one of the styles that is related to margin, espe.. rccode.tistory.com This post is advanced version of abo..