problem 4

This commit is contained in:
Xevion
2019-08-15 22:13:03 -05:00
parent 521c6be127
commit 63afb03484
6 changed files with 32 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
C793A
B83B5
4ABAC

View File

@@ -0,0 +1,24 @@
import sys, os
def evaluate(patterns, a, b, c):
mapping = str.maketrans('ABC', str(a) + str(b) + str(c))
x, y, z = patterns[0].translate(mapping), patterns[1].translate(mapping), patterns[2].translate(mapping)
x, y, z = int(x), int(y), int(z)
if x + y == z:
return [x, y, z]
def main():
# Read Input Data
path = os.path.join(sys.path[0], 'input')
data = open(path, 'r').read().split('\n')
# Just cycle through all iterations until one is found.
for x in range(10):
for y in range(10):
for z in range(10):
result = evaluate(data, x, y, z)
if result:
return result
if __name__ == "__main__":
print(main())

View File

@@ -0,0 +1,5 @@
# 1991 YSU-ACM High School Programming Contest
These problems honestly seem extraordinarily easy, but it's likely do to the constraints of computer programming back then. Kind of cheating, using Python.
[Official Link](https://people.eecs.berkeley.edu/~hilfingr/programming-contest/ysu_91.pdf) | [GitHub Mirror](./ysu_91.pdf)

View File

Binary file not shown.