위치 | 승패 | 수 |
---|---|---|
25 | L | |
24 | W | 1 |
23 | W | 2 |
22 | W | 3 |
21 | W | 4 |
18 | L | 7/23/21/22 |
- 복귀자 1명일때 시간: (t.2 + t.1) + (t.3 + t.1) + t.4 = 2t.1 + t.2 + t.3 + t.4
- 복귀자 2명일때 시간: (t.2 + t.1) + (t.4 + t.2) + t.2 = t.1 + 3t.2 + t.4
(최소 시간)
= (2t.1 + t.2 + t.3 + t.4)
t는 각각 1, 2, 5, 10 이므로 대입하면 17분이다.
1번 사람이 더 빠른 경우는 1번 사람 3번 사람의 건너는 시간의 합이 2번 사람 건너는 시간의 두 배보다 작은 경우이므로
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package lascala.aoc2021.day1_10.day9 | |
case class Point(row: Int, column: Int) | |
case class HeightMap( | |
map: Map[Point, Int], | |
numberOfRows: Int, | |
numberOfColumns: Int, | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package lascala.aoc2021.day1_10.day8 | |
opaque type Digit = Set[Char] | |
opaque type SignalPattern = Set[Digit] | |
def parse(s: String): (SignalPattern, Seq[Digit]) = | |
val Array(pattern, digits) = s.split(" \\| ") | |
def parsePart(s: String): Seq[Digit] = | |
s.split(" ").map(_.toSet).toSeq | |
(parsePart(pattern).toSet, parsePart(digits)) |
NewerOlder