ysu-acm solves and icpc A & B

This commit is contained in:
Xevion
2019-08-24 18:03:31 -05:00
parent 63afb03484
commit 3297bcd237
16 changed files with 156 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
5
2
3
1
2

View File

@@ -0,0 +1,9 @@
import sys, os
# Read the data
path = os.path.join(sys.path[0], 'input')
data = open(path, 'r').read().split('\n')
data = list(map(int, data))
assert all(map(lambda x : x >= 1, data))
print('\n\n'.join('\n'.join('*' * x for x in range(n, 0, -1))for n in data))

View File

@@ -0,0 +1,2 @@
5
100

View File

@@ -0,0 +1,16 @@
import os, sys, math
path = os.path.join(sys.path[0], 'input')
data = open(path, 'r').read().split('\n')
# To keep with the times of 1991, we will use the constraints of Python2 for max integers
maxInt = 9223372036854775807
def extend(n):
res = 1
for x in range(2, n + 1):
res = x * res
return res
x = 100
print(extend(x))
print(math.log(extend(x), 10))

View File

@@ -0,0 +1,23 @@
18
7
11
1
0
3
13
9
12
4
2
0
16
17
4
8
0
10
8
3
6
8
4

View File

@@ -0,0 +1,5 @@
THIS IS THE ('FIRST') LINE IN THE SAMPLE FILE!!!!
ANY CHARACTERS CAN BE IN THE FILE%^$*.(")...
('THIS PART OF THE FILE SHOULD NOT BE CHANGED')
'(BUT THIS PART SHOULD 123........('...............
NUMBERS, 1234567890, ARE OK. OK?

View File

@@ -0,0 +1,14 @@
import re, string, os, sys
pattern = r'([\s\S]*)(\(.*\))([\s\S]*)'
def main():
path = os.path.join(sys.path[0], 'input')
mapping = str.maketrans(string.ascii_uppercase, string.ascii_uppercase[::-1])
print(string.ascii_uppercase)
print(string.ascii_uppercase[::-1])
data = open(path, 'r').read()
matches = re.findall(pattern, data)[0]
result = ''
for match in matches:
result += match if match.startswith('(') else match.translate(mapping)
print(result)

View File

@@ -2,4 +2,20 @@
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)
[Official Link](https://people.eecs.berkeley.edu/~hilfingr/programming-contest/ysu_91.pdf) | [GitHub Mirror](./ysu_91.pdf)
## Notice
Inputs / Outputs are retyped since the PDF is obsfucated.
## Progress
#1 : Solved
#2 : **Unsolved**
#3 : **Unsolved**
#4 : Solved
#5 : **Unsolved**