Skip to content

Commit 3f2ce11

Browse files
committed
estudos
1 parent 03707f3 commit 3f2ce11

File tree

5 files changed

+44
-24
lines changed

5 files changed

+44
-24
lines changed

kotlin/LukeBalance/.idea/workspace.xml

Lines changed: 36 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.
Binary file not shown.
Binary file not shown.

kotlin/LukeBalance/src/Solution.kt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,24 @@ fun luckBalance(k: Int, contests: Array<Array<Int>>): Int {
99

1010
return acc
1111
}
12+
/**
13+
3 2
14+
5 1
15+
1 1
16+
4 0
17+
* */
1218

1319
fun main(args: Array<String>) {
1420
val data = readLine()!!.split(" ").map(String::toInt).toTypedArray()
1521
val n = data[0]
16-
val k = data[0]
17-
22+
val k = data[1]
1823
val contest = Array(n) { it -> Array(2) {0}}
19-
2024
for (i in 0 until n) {
2125
contest[i] = readLine()!!.split(" ").map(String::toInt).toTypedArray()
2226
}
23-
2427
val comp = Comparator<Array<Int>> {
25-
p, q -> p[0].compareTo(q[1])
28+
p, q -> q[1].compareTo(p[1])
2629
}
27-
2830
contest.sortWith(comp)
29-
3031
println(luckBalance(k, contest))
3132
}

0 commit comments

Comments
 (0)