You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
823 B
Python
33 lines
823 B
Python
from typing import *
|
|
inp = open("input.txt", "w")
|
|
out = open("output.txt", "w")
|
|
|
|
|
|
def readfile(filename: str) -> List[str]:
|
|
with open(filename) as f:
|
|
return [
|
|
x.strip().replace(',', '') for x in f.readlines()
|
|
if not x.isspace()
|
|
]
|
|
|
|
|
|
in1_1 = readfile("Augent.txt")
|
|
in1_2 = readfile("Addent.txt")
|
|
in2 = readfile("in2.txt")
|
|
out2 = readfile("out2.txt")
|
|
in3 = readfile("in3.txt")
|
|
out3 = readfile("out3.txt")
|
|
|
|
inp.write(f"{len(in1_1) + len(in2) + len(in3)}\n")
|
|
|
|
for a, b in zip(in1_1, in1_2):
|
|
inp.write(f"1 {a} {b}\n")
|
|
out.write(f"{int(a) + int(b)}\n")
|
|
for i, o in zip(in2, out2):
|
|
_i = i.split()
|
|
inp.write(f"2 {_i[0]} {_i[2]} {_i[1]}\n")
|
|
out.write(f"{o}\n")
|
|
for i, o in zip(in3, out3):
|
|
_i = i.split()
|
|
inp.write(f"3 {_i[0]} {_i[1]}\n")
|
|
out.write(f"{o}\n") |