일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 프로젝트
- 스프링
- TDD
- 모던자바
- 그래프
- 자바
- 코틀린
- algorithm
- Brute-force
- backtracking
- programmers
- back-end
- Spring
- DFS
- baekjoon
- lambda
- BFS
- 자료구조
- OS
- kotlin
- LEVEL2
- 프로그래머스
- 운영체제
- 알고리즘
- java
- 네트워크
- DP
- Java8
- 백준
- 백트래킹
- Today
- Total
목록백준 (37)
요깨비's LAB

import java.util.ArrayList; import java.util.List; import java.util.Scanner; class Cow { int id; List preferences; public Cow(int id) { this.id = id; this.preferences = new ArrayList(); } } public class Main { public static int[] barns; public static boolean[] isProccesed; public static List cows; public static int N; public static int M; public static void main(String[] args) { Scanner scr = ne..

import java.util.ArrayList; import java.util.List; import java.util.PriorityQueue; import java.util.Scanner; class Vertax { int id; boolean isVisited; List edges; public Vertax(int id) { this.id = id; this.isVisited = false; this.edges = new ArrayList(); } } class Edge { int from; int to; int value; public Edge(int from, int to, int value) { this.from = from; this.to = to; this.value = value; } ..

import java.util.ArrayList; import java.util.List; import java.util.Scanner; class Vertax { Vertax parent; int id; boolean isVisited; public Vertax(int id) { this.id = id; parent = this; isVisited = false; } public Vertax findParent(Vertax v) { if (v.id == v.parent.id) { return v; } return v = findParent(v.parent); } public long merge(Vertax to, long total, int cost) { Vertax from = findParent(p..

이번에는 프림 알고리즘 방식으로 풀었습니다. 이것 또한 정점과 간선을 인스턴스화 하여 풀었습니다. import java.util.*; class Vertax { int id; boolean isVisited; List linkedVertaxes; public Vertax(int id) { this.id = id; this.isVisited = false; this.linkedVertaxes = new ArrayList(); } } class Edge { int toId; int value; public Edge(int toId, int value) { this.toId = toId; this.value = value; } } public class Main { public static void main(..

MST를 이용해서 풀었으며, 기존의 배열을 활용한 풀이보다는 각각의 정점과 간선을 인스턴스화하여 푸는 방식으로 진행하였습니다. import java.util.ArrayList; import java.util.List; import java.util.Scanner; class Vertax { Vertax parent; int id; boolean isVisted; public Vertax(int id, boolean isVisted) { this.parent = this; this.id = id; this.isVisted = isVisted; } public Vertax findParent(Vertax p) { // System.out.println(this.id + ", " + p.id); if(p.id..

import java.util.* var C:Int = 0 fun main() { val scr = Scanner(System.`in`) C = scr.nextInt() val results = StringBuffer() for(i in 0 until C) { val N = scr.nextInt() val scores = mutableListOf() var total = 0 for(j in 0 until N) { val score = scr.nextInt() total += score scores.add(score) } val avg = total/N var count = 0 for(j in 0 until N) { if(scores[j] > avg) count++ } val result = String...

import java.util.* var energyBalls = mutableListOf() var N: Int = 0 var max = Int.MIN_VALUE fun main() { val scr = Scanner(System.`in`) N = scr.nextInt() for (i in 0 until N) { val element = scr.nextInt() energyBalls.add(element) } doAlgorithm(0, 0, N) println(max) } fun doAlgorithm(count: Int, value: Int, size: Int) { if (energyBalls.size == 2) { max = if (max < value) value else max return } f..

import java.util.* var N = 0 var max = Int.MIN_VALUE var min = Int.MAX_VALUE val elements = mutableListOf() val operators = mutableListOf() fun main() { val scr = Scanner(System.`in`) N = scr.nextInt() for (i in 0 until N) { val element = scr.nextInt() elements.add(element) } for (i in 0 until 4) { val operator = scr.nextInt() operators.add(operator) } doAlgorithm(1, elements[0]) println(max) pr..