From 458b10e17badb05f1a1c32065dbd5386e5851015 Mon Sep 17 00:00:00 2001 From: Skullheadx <704277@pdsb.net> Date: Wed, 4 Jan 2023 17:40:50 -0500 Subject: [PATCH] S1 2012 + grader --- .gitignore | 2 + Main/Python/2012/S1.py | 21 ++++++++ .../2012/__pycache__/S1.cpython-310.pyc | Bin 0 -> 401 bytes .../Python/__pycache__/tester.cpython-310.pyc | Bin 0 -> 416 bytes Main/Python/grader.py | 50 ++++++++++++++++++ Main/Python/tester.py | 6 +++ Main/__pycache__/test.cpython-310.pyc | Bin 0 -> 145 bytes Main/__pycache__/test2.cpython-310.pyc | Bin 0 -> 151 bytes Main/test.py | 30 ++++++++++- Main/test2.py | 2 + 10 files changed, 109 insertions(+), 2 deletions(-) create mode 100644 Main/Python/2012/S1.py create mode 100644 Main/Python/2012/__pycache__/S1.cpython-310.pyc create mode 100644 Main/Python/__pycache__/tester.cpython-310.pyc create mode 100644 Main/Python/grader.py create mode 100644 Main/Python/tester.py create mode 100644 Main/__pycache__/test.cpython-310.pyc create mode 100644 Main/__pycache__/test2.cpython-310.pyc create mode 100644 Main/test2.py diff --git a/.gitignore b/.gitignore index bc2a419..17ada73 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ *.exe .idea/CCC.iml .idea/misc.xml +*.in +*.out \ No newline at end of file diff --git a/Main/Python/2012/S1.py b/Main/Python/2012/S1.py new file mode 100644 index 0000000..2a76b58 --- /dev/null +++ b/Main/Python/2012/S1.py @@ -0,0 +1,21 @@ +from queue import Queue + + +J = int(input()) + +q = Queue() +q.put([J]) + +output = 0 + +while not q.empty(): + current = q.get() + + if len(current) == 4: + output += 1 + continue + + for i in range(1,current[-1]): + q.put(current + [i]) + +print(output) diff --git a/Main/Python/2012/__pycache__/S1.cpython-310.pyc b/Main/Python/2012/__pycache__/S1.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6f947daf9ff8f503aad695f5d5de0e5e4fa9d8eb GIT binary patch literal 401 zcmd1j<>g{vU|^W=YHP9rBLl-@5C<8vGB7YWFfcF_cQG(9q%fo~<}lw7T&ditT+NIr zOxa9DnyKt5%;pSH?1f^fJSohnTq!J)49!d~46$5MykK*g{vU|^W=Z)@^e1_p-5APzESVqjo!U|?V<)?r{^NMT4}%wdRv(2P-xU_Mh6 z6PRX>VoqU7VQyiFVo6~PX3%7L2{OkonHfYuF^J91z`)=PGEt9#fuV$90b>o*LdFuN zc;*t864ny7EcOK)H4HV3DU9L_3z?c37jQ0QXl7(&NMQ(O&}8zfV%96D)a1Iwl$n2v zBe-}^KLQa7vEwjNG!>?#gdf|k}FD0 zOwnY%#S-8c;&F>TAjsdz$JO^1S4nDdNqlBrL21cKh9Z6j28LhCE>ZgFPj s7UUO|g{vU|?YSu{Al0nStRkh=Yuo7#J8F7#J9e1sE6@QW&BbQW;Yjni&}xQW%37 zG?`v9GB7asX)@hnthmKmP?VWhvXY^Qg@FM={E~99igC{@$tX>Vadvi&@lDLkiz!Jh cF3~Hfyv1RYo1apelWGStq8Oxyg@K0=06*Lv=l}o! literal 0 HcmV?d00001 diff --git a/Main/__pycache__/test2.cpython-310.pyc b/Main/__pycache__/test2.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..54082a81c14612e2b48b99487e67975663a60a1d GIT binary patch literal 151 zcmd1j<>g{vU|@*M-D1lxEh#81xy4#gl$lqulA(x&fdNANl6J9*anCHtC{2oSc6N^OP0Y-T gDM>9ZG14ojyv1RYo1apelWNBZvIL}wg@K0=07s}GbN~PV literal 0 HcmV?d00001 diff --git a/Main/test.py b/Main/test.py index ffaa416..7b0b575 100644 --- a/Main/test.py +++ b/Main/test.py @@ -1,5 +1,31 @@ -test = {1:0,2:1,3:-1} -print(max(test.values())) +import io, sys, os +import importlib + +class Capturing(list): + def __enter__(self): + self._stdout = sys.stdout + sys.stdout = self._stringio = io.StringIO() + return self + def __exit__(self, *args): + self.extend(self._stringio.getvalue().splitlines()) + del self._stringio # free up some memory + sys.stdout = self._stdout + + +filename = "test2.py" +# file = + + +for i in range(3): + with Capturing() as output: + x = os.system(filename) + + print("\n".join(output), type(output)) + print("a") + + +# test = {1:0,2:1,3:-1} +# print(max(test.values())) # test = {1,2,3} diff --git a/Main/test2.py b/Main/test2.py new file mode 100644 index 0000000..b0fc313 --- /dev/null +++ b/Main/test2.py @@ -0,0 +1,2 @@ +output = 0 +print(output) \ No newline at end of file -- 2.54.0