project-euler/109_darts.py

25 lines
470 B
Python

#!/usr/bin/env python3
bull = [25]
miss = [0]
fields = list(range(1, 21))
single = fields + bull
double = [2*i for i in single]
treble =[3*i for i in fields]
regs = miss + single + double + treble
regs.sort()
count = 0
score = 100
for fst in double:
for i, sec in enumerate(regs):
if fst + 2*sec >= score:
break
for thd in regs[i:]:
if fst + sec + thd >= score:
break
count += 1
print(count)