Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Python
- left, right = map(sorted, zip(*[map(int, line.split()) for line in open("input.txt)]))
- print(sum(abs(i-j) for i,j in zip(left,right)))
- print(sum(i*right.count(i) for i in left))
- #Julia
- using DelimitedFiles
- left, right = map(x -> sort(readdlm("input.txt", Int)[:, x]), 1:2)
- println(sum(abs, left-right))
- println(sum(i * count(x -> x == i, right) for i in left))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement