Greedy3 [백준] 회의실배정 (1931)(Kotlin) 원본 문제 : https://www.acmicpc.net/problem/1931 문제 참고 : https://ju-nam2.tistory.com/44 import java.util.* class Meeting : Comparable { var start: Int = 0 var end: Int = 0 constructor(start: Int, end: Int) { this.start = start this.end = end } override fun compareTo(other: Meeting): Int { if (this.end == other.end) { return Integer.compare(this.start, other.end) } else { return Integer.compare(this... 2020. 2. 20. [백준] 동전 0 (11047)(Kotlin) 원본 문제 : https://www.acmicpc.net/problem/11047 import java.util.* fun main() { val sc: Scanner = Scanner(System.`in`) val N: Int = sc.nextInt() val AIM: Int = sc.nextInt() var coinList: IntArray = IntArray(N) for (i in 0 until N) { coinList[i] = sc.nextInt() } coinList.sortDescending() var cnt: Int = 0 var sum: Int = 0 for (i in 0 until N) { while (true) { if (coinList[i] < AIM) { if (coinList[i].. 2020. 2. 20. [백준] ATM (11399)(Kotlin) 원본 문제 : https://www.acmicpc.net/problem/11399 import java.util.* fun main() { val sc: Scanner = Scanner(System.`in`) val N: Int = sc.nextInt() var time: IntArray = IntArray(N) for (i in 0 until N) { time[i] = sc.nextInt() } Arrays.sort(time) var t: Int = 0 var sum: Int = 0 for (i in 0 until N) { t += time[i] sum += t } println(sum) } 2020. 2. 20. 이전 1 다음