2020-12-11 22:25:14 +01:00
|
|
|
import Foundation
|
|
|
|
|
2020-12-22 07:46:43 +01:00
|
|
|
let input = Scanner(string: loadData(day: 1)).integers()
|
2020-12-11 22:25:14 +01:00
|
|
|
|
|
|
|
for i in 0..<input.count {
|
|
|
|
for j in i..<input.count {
|
|
|
|
for k in j..<input.count {
|
|
|
|
let a = input[i]
|
|
|
|
let b = input[j]
|
|
|
|
let c = input[k]
|
|
|
|
|
|
|
|
if k == j && a + b == 2020 {
|
|
|
|
print("1st", a * b)
|
|
|
|
}
|
|
|
|
|
|
|
|
if a + b + c == 2020 {
|
|
|
|
print("2nd", a * b * c)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|