32 lines
841 B
Python
Executable File
32 lines
841 B
Python
Executable File
#!/usr/bin/env python
|
|
|
|
import re
|
|
import argparse
|
|
|
|
def load_file(filename):
|
|
with open(filename) as f:
|
|
data = f.readlines()
|
|
return data
|
|
|
|
def main(args):
|
|
TRIANGLE_GOOD = 0
|
|
for LINE in load_file(args.input):
|
|
LINE = LINE.strip()
|
|
token = re.split(r'\s{1,}', LINE)
|
|
|
|
if (int(token[0]) + int(token[1]) <= int(token[2])):
|
|
continue
|
|
if (int(token[2]) + int(token[0]) <= int(token[1])):
|
|
continue
|
|
if (int(token[1]) + int(token[2]) <= int(token[0])):
|
|
continue
|
|
TRIANGLE_GOOD += 1
|
|
|
|
print(TRIANGLE_GOOD)
|
|
if __name__ == "__main__":
|
|
parser = argparse.ArgumentParser(description='AdventOfCode 2016 Day 01')
|
|
parser.add_argument('--input', '-i', action='store', required=True, help='input file')
|
|
args = parser.parse_args()
|
|
|
|
main(args)
|