Compare commits
No commits in common. "6d90ad5b4110e6318ba62b9e8d0b97a30c0b77da" and "2a7e04ef2b7f1960d49abe82c2efd27f439250b7" have entirely different histories.
6d90ad5b41
...
2a7e04ef2b
1000
2015/day5/input
1000
2015/day5/input
File diff suppressed because it is too large
Load Diff
@ -1,40 +0,0 @@
|
|||||||
#!/bin/python3
|
|
||||||
|
|
||||||
import sys
|
|
||||||
from pprint import pprint
|
|
||||||
|
|
||||||
input_f = sys.argv[1]
|
|
||||||
|
|
||||||
result = 0
|
|
||||||
|
|
||||||
with open(input_f) as file:
|
|
||||||
for line in file:
|
|
||||||
tmp = line.rstrip()
|
|
||||||
print(tmp)
|
|
||||||
vowel_count = 0
|
|
||||||
t = ['ab','cd','pq','xy']
|
|
||||||
first = False
|
|
||||||
second = False
|
|
||||||
for i in t:
|
|
||||||
if tmp.find(i) != -1:
|
|
||||||
print(" is naughty because it contains " + i)
|
|
||||||
first = True
|
|
||||||
break
|
|
||||||
f = 'aeiou'
|
|
||||||
for idx,i in enumerate(tmp):
|
|
||||||
if idx+1 < len(tmp) and first == False:
|
|
||||||
#print(idx,idx+1,len(tmp))
|
|
||||||
if i == tmp[idx+1]:
|
|
||||||
second = True
|
|
||||||
if second == False and first == False:
|
|
||||||
print("naughte cus no double")
|
|
||||||
for idx,i in enumerate(tmp):
|
|
||||||
if f.find(i) != -1 and second == True and first == False:
|
|
||||||
vowel_count += 1
|
|
||||||
if vowel_count == 3:
|
|
||||||
print(" is nice because it contains " + str(vowel_count) + " vowels and double letters")
|
|
||||||
result += 1
|
|
||||||
if second == True and vowel_count < 3:
|
|
||||||
print("naughty cus " + str(vowel_count) + " vowels")
|
|
||||||
print()
|
|
||||||
print(result)
|
|
@ -1,5 +0,0 @@
|
|||||||
ugknbfddgicrmopn
|
|
||||||
aaa
|
|
||||||
jchzalrnumimnmhp
|
|
||||||
haegwjzuvuyypxyu
|
|
||||||
dvszwmarrgswjxmb
|
|
@ -11,8 +11,8 @@ seeds, *maps = open(input_f).read().split('\n\n')
|
|||||||
|
|
||||||
seeds = seeds.split(':')[1].split()
|
seeds = seeds.split(':')[1].split()
|
||||||
|
|
||||||
#pprint(seeds)
|
pprint(seeds)
|
||||||
#pprint(maps)
|
pprint(maps)
|
||||||
|
|
||||||
tmp_seeds = []
|
tmp_seeds = []
|
||||||
|
|
||||||
@ -22,23 +22,20 @@ for i in range(0,len(seeds)-1,2):
|
|||||||
tmp_seeds.append(j)
|
tmp_seeds.append(j)
|
||||||
|
|
||||||
seeds = tmp_seeds
|
seeds = tmp_seeds
|
||||||
|
#print(seeds)
|
||||||
total=len(seeds)*7
|
|
||||||
count = 0
|
|
||||||
|
|
||||||
for i in maps:
|
for i in maps:
|
||||||
tmp = []
|
tmp = []
|
||||||
i = i.split()
|
i = i.split()
|
||||||
#print(i)
|
#print(i)
|
||||||
|
|
||||||
for ldx,l in enumerate(seeds):
|
for ldx,l in enumerate(seeds):
|
||||||
l = int(l)
|
l = int(l)
|
||||||
count += 1
|
|
||||||
for x in range(2,len(i)-2,3):
|
for x in range(2,len(i)-2,3):
|
||||||
d = int(i[x])
|
d = int(i[x])
|
||||||
s = int(i[x+1])
|
s = int(i[x+1])
|
||||||
r = int(i[x+2])
|
r = int(i[x+2])
|
||||||
#print('Looking for ' + str(l) + ' in range ' + str(s) + ' > ' + str((s+r)),end='')
|
#print('Looking for ' + str(l) + ' in range ' + str(s) + ' > ' + str((s+r)),end='')
|
||||||
print(str(round(count/total*100,2)))
|
|
||||||
if s <= l and l < s + r:
|
if s <= l and l < s + r:
|
||||||
seeds[ldx] = d + (l - s)
|
seeds[ldx] = d + (l - s)
|
||||||
#print('. Found!')
|
#print('. Found!')
|
||||||
|
Loading…
Reference in New Issue
Block a user