cleaned 5a, toying with swift in 1a, updated gitignore to not include binaries

kwout 2 years ago
parent 5968c16f18
commit a304953805
  1. 4
      .gitignore
  2. 15
      2021/day1/1a.swift
  3. 2
      2021/day5/5a.py

4
.gitignore vendored

@ -1,2 +1,6 @@
*
!*.*
!*/
*.swp
*.swo

@ -0,0 +1,15 @@
import Foundation
let contents = try! String(contentsOfFile: "input.txt")
var lines = [Int]()
for l in contents.split(separator:"\n") {
lines.append(Int(l)!)
}
var increases = 0
for i in 1..<lines.count {
if lines[i] > lines[i-1] {
increases += 1
}
}
print(increases)

@ -6,7 +6,6 @@ for l in open("input.txt", 'r').read().splitlines():
q.append(p[1].split(","))
lines.append([[int(q[0][0]),int(q[0][1])],[int(q[1][0]), int(q[1][1])]])
grid = [[0 for i in range(1000)] for j in range(1000)]
print(lines)
for l in lines:
if l[0][0] == l[1][0]:
@ -22,7 +21,6 @@ for l in lines:
overlaps=0
for m in grid:
print(m)
for n in m:
if n > 1:
overlaps += 1

Loading…
Cancel
Save