diff --git a/JacobRaymond/measurement/solution.py b/JacobRaymond/measurement/solution.py new file mode 100644 index 0000000..f7a0893 --- /dev/null +++ b/JacobRaymond/measurement/solution.py @@ -0,0 +1,48 @@ +abbrv_map = { + 'th': 'thou', + 'in': 'inch', + 'ft': 'foot', + 'yd': 'yard', + 'ch': 'chain', + 'fur': 'furlong', + 'mi': 'mile', + 'lea': 'league' +} + +val_map = { + 'thou': 1, + 'inch': 1000, + 'foot': 12, + 'yard': 3, + 'chain': 22, + 'furlong': 10, + 'mile': 8, + 'league': 3 +} + +unit_order = ['thou','inch','foot','yard','chain','furlong','mile','league'] +inv_unit_order = dict(zip(unit_order, range(len(unit_order)))) + +x, u, _, v = input().split() +x = int(x) + +if u in abbrv_map: + u = abbrv_map[u] +if v in abbrv_map: + v = abbrv_map[v] + +ui = inv_unit_order[u] +vi = inv_unit_order[v] + +start = min((ui,vi))+1 +end = max((ui,vi))+1 + +amnt = 1 +for unit in unit_order[start:end]: + amnt *= val_map[unit] + +if ui < vi: + print(x / amnt) +else: + print(x * amnt) + diff --git a/JacobRaymond/numbertree/solution.py b/JacobRaymond/numbertree/solution.py new file mode 100644 index 0000000..adc8f2d --- /dev/null +++ b/JacobRaymond/numbertree/solution.py @@ -0,0 +1,3 @@ +H, *P = input().split() +P = P[0] if len(P) > 0 else '' +print(2**(int(H)+1) - 2**len(P) - (int(P.replace('L','0').replace('R','1'),2) if len(P) > 0 else 0)) diff --git a/JacobRaymond/recount/solution.py b/JacobRaymond/recount/solution.py new file mode 100644 index 0000000..68d856e --- /dev/null +++ b/JacobRaymond/recount/solution.py @@ -0,0 +1,8 @@ +from collections import Counter + +top_2 = Counter(line.strip() for line in iter(input, "***")).most_common(2) +if (top_2[0][1] != top_2[1][1]): + print(top_2[0][0]) +else: + print("Runoff!") +