diff --git a/berkely/1991 YSU-ACM High School Programming Contest/4/input b/berkely/1991 YSU-ACM High School Programming Contest/4/input new file mode 100644 index 0000000..34f2e48 --- /dev/null +++ b/berkely/1991 YSU-ACM High School Programming Contest/4/input @@ -0,0 +1,3 @@ +C793A +B83B5 +4ABAC \ No newline at end of file diff --git a/berkely/1991 YSU-ACM High School Programming Contest/4/main.py b/berkely/1991 YSU-ACM High School Programming Contest/4/main.py new file mode 100644 index 0000000..004535b --- /dev/null +++ b/berkely/1991 YSU-ACM High School Programming Contest/4/main.py @@ -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()) \ No newline at end of file diff --git a/berkely/1991 YSU-ACM High School Programming Contest/README.MD b/berkely/1991 YSU-ACM High School Programming Contest/README.MD new file mode 100644 index 0000000..535c510 --- /dev/null +++ b/berkely/1991 YSU-ACM High School Programming Contest/README.MD @@ -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) \ No newline at end of file diff --git a/berkely/1991 YSU-ACM High School Programming Contest/input4 b/berkely/1991 YSU-ACM High School Programming Contest/input4 deleted file mode 100644 index e69de29..0000000 diff --git a/berkely/1991 YSU-ACM High School Programming Contest/problem4.py b/berkely/1991 YSU-ACM High School Programming Contest/problem4.py deleted file mode 100644 index e69de29..0000000 diff --git a/berkely/1991 YSU-ACM High School Programming Contest/ysu_91.pdf b/berkely/1991 YSU-ACM High School Programming Contest/ysu_91.pdf new file mode 100644 index 0000000..3e0abfb Binary files /dev/null and b/berkely/1991 YSU-ACM High School Programming Contest/ysu_91.pdf differ