This tasks were made month ago but i remembered upload to git - I am so sorry!

This commit is contained in:
IgnBys 2024-01-08 12:05:14 +01:00
parent c5d488229f
commit f74d717d03
26 changed files with 381 additions and 1 deletions

View File

@ -1,4 +1,4 @@
34234 34 5 ё34234 34 5
34535 34535
34 34
1992 1999 1992 1999

20
TaskE00/run.py Normal file
View File

@ -0,0 +1,20 @@
import sys
import re
def write_answer(answer):
with open(output_file, 'a') as file:
file.write(answer+'\n')
input_file = 'test.in'
output_file = 'test.out'
# input_file = sys.argv[1]
# output_file = sys.argv[2]
pattern = re.compile(r'-?[1-9][0-9]*[05]$|^0$')
with open(output_file, 'w') as readed_output_file:
with open(input_file, 'r') as readed_input_file:
for row_input_file in readed_input_file:
if pattern.match(row_input_file):
write_answer('yes')
else:
write_answer('no')

10
TaskE00/test.out Normal file
View File

@ -0,0 +1,10 @@
yes
yes
no
yes
no
no
yes
no
yes
no

20
TaskE01/run.py Normal file
View File

@ -0,0 +1,20 @@
import sys
import re
def write_answer(answer):
with open(output_file, 'a') as file:
file.write(answer+'\n')
# input_file = 'test.in'
# output_file = 'test.out'
input_file = sys.argv[1]
output_file = sys.argv[2]
pattern = re.compile(r'^\d*(00|25|50|75)$')
with open(output_file, 'w') as readed_output_file:
with open(input_file, 'r') as readed_input_file:
for row_input_file in readed_input_file:
if pattern.match(row_input_file):
write_answer('yes')
else:
write_answer('no')

8
TaskE01/test.out Normal file
View File

@ -0,0 +1,8 @@
no
yes
yes
yes
no
no
no
no

21
TaskE02/run.py Normal file
View File

@ -0,0 +1,21 @@
import sys
import re
def write_answer(answer):
with open(output_file, 'a') as file:
file.write(answer+'\n')
# input_file = 'test.in'
# output_file = 'test.out'
input_file = sys.argv[1]
output_file = sys.argv[2]
pattern = re.compile(r'^\d{2}-\d{3}')
pattern2 = re.compile(r'^(\d{2})')
with open(output_file, 'w') as readed_output_file:
with open(input_file, 'r') as readed_input_file:
for row_input_file in readed_input_file:
if pattern.match(row_input_file):
write_answer(pattern2.match(row_input_file).group(1))
else:
write_answer('<NONE>')

6
TaskE02/test.out Normal file
View File

@ -0,0 +1,6 @@
<NONE>
<NONE>
23
<NONE>
61
<NONE>

20
TaskE03/run.py Normal file
View File

@ -0,0 +1,20 @@
import sys
import re
def write_answer(answer):
with open(output_file, 'a') as file:
file.write(answer+'\n')
# input_file = 'test.in'
# output_file = 'test.out'
input_file = sys.argv[1]
output_file = sys.argv[2]
pattern = re.compile(r'^\d{3}-(\d{3}-\d{2}-\d{2}|\d{2}-\d{2}-\d{3})$')
with open(output_file, 'w') as readed_output_file:
with open(input_file, 'r') as readed_input_file:
for row_input_file in readed_input_file:
if pattern.match(row_input_file):
write_answer('yes')
else:
write_answer('no')

5
TaskE03/test.out Normal file
View File

@ -0,0 +1,5 @@
yes
yes
yes
no
no

21
TaskE04/run.py Normal file
View File

@ -0,0 +1,21 @@
import sys
import re
def write_answer(answer):
with open(output_file, 'a') as file:
file.write(answer+'\n')
# input_file = 'test.in'
# output_file = 'test.out'
input_file = sys.argv[1]
output_file = sys.argv[2]
pattern = re.compile(r'^555( \d{3} \d{3}|-\d{3}-\d{3})')
with open(output_file, 'w') as readed_output_file:
with open(input_file, 'r') as readed_input_file:
for row_input_file in readed_input_file:
if pattern.match(row_input_file):
write_answer('yes')
else:
write_answer('no')

12
TaskE04/test.out Normal file
View File

@ -0,0 +1,12 @@
no
no
no
yes
no
yes
no
yes
yes
no
no
no

20
TaskE05/run.py Normal file
View File

@ -0,0 +1,20 @@
import sys
import re
def write_answer(answer):
with open(output_file, 'a') as file:
file.write(answer+'\n')
# input_file = 'test.in'
# output_file = 'test.out'
input_file = sys.argv[1]
output_file = sys.argv[2]
pattern = re.compile(r'^(PCMCIA|WYSIWYG|[A-Z]{2,5})$')
with open(output_file, 'w') as readed_output_file:
with open(input_file, 'r') as readed_input_file:
for row_input_file in readed_input_file:
if pattern.match(row_input_file):
write_answer('yes')
else:
write_answer('no')

11
TaskE05/test.out Normal file
View File

@ -0,0 +1,11 @@
no
yes
yes
no
yes
yes
no
no
no
yes
yes

21
TaskE06/run.py Normal file
View File

@ -0,0 +1,21 @@
import sys
import re
def write_answer(answer):
with open(output_file, 'a') as file:
file.write(answer+'\n')
# input_file = 'test.in'
# output_file = 'test.out'
input_file = sys.argv[1]
output_file = sys.argv[2]
pattern = re.compile(r'^[1-9](\d{4}|\d{5})$')
with open(output_file, 'w') as readed_output_file:
with open(input_file, 'r') as readed_input_file:
for row_input_file in readed_input_file:
if pattern.match(row_input_file):
write_answer('yes')
else:
write_answer('no')

10
TaskE06/test.out Normal file
View File

@ -0,0 +1,10 @@
no
no
yes
yes
yes
yes
no
no
yes
yes

21
TaskE07/run.py Normal file
View File

@ -0,0 +1,21 @@
import sys
import re
def write_answer(answer):
with open(output_file, 'a') as file:
file.write(answer+'\n')
# input_file = 'test.in'
# output_file = 'test.out'
input_file = sys.argv[1]
output_file = sys.argv[2]
pattern = re.compile(r'^\*+$')
with open(output_file, 'w') as readed_output_file:
with open(input_file, 'r') as readed_input_file:
for row_input_file in readed_input_file:
if pattern.match(row_input_file):
write_answer('yes')
else:
write_answer('no')

7
TaskE07/test.out Normal file
View File

@ -0,0 +1,7 @@
yes
yes
yes
yes
no
no
no

20
TaskE08/run.py Normal file
View File

@ -0,0 +1,20 @@
import sys
import re
def write_answer(answer):
with open(output_file, 'a') as file:
file.write(answer+'\n')
# input_file = 'test.in'
# output_file = 'test.out'
input_file = sys.argv[1]
output_file = sys.argv[2]
pattern = re.compile(r'(hi){2,}(!*?)$')
with open(output_file, 'w') as readed_output_file:
with open(input_file, 'r') as readed_input_file:
for row_input_file in readed_input_file:
if pattern.search(row_input_file):
write_answer('yes')
else:
write_answer('no')

10
TaskE08/test.out Normal file
View File

@ -0,0 +1,10 @@
no
no
no
no
yes
yes
yes
yes
yes
no

20
TaskE09/run.py Normal file
View File

@ -0,0 +1,20 @@
import sys
import re
def write_answer(answer):
with open(output_file, 'a') as file:
file.write(answer+'\n')
# input_file = 'test.in'
# output_file = 'test.out'
input_file = sys.argv[1]
output_file = sys.argv[2]
pattern = re.compile(r'[A-Z]\d{2}')
with open(output_file, 'w') as readed_output_file:
with open(input_file, 'r') as readed_input_file:
for row_input_file in readed_input_file:
if pattern.search(row_input_file):
write_answer('yes')
else:
write_answer('no')

9
TaskE09/test.out Normal file
View File

@ -0,0 +1,9 @@
yes
no
no
yes
no
no
no
yes
yes

20
TaskE10/run.py Normal file
View File

@ -0,0 +1,20 @@
import sys
import re
def write_answer(answer):
with open(output_file, 'a') as file:
file.write(answer+'\n')
input_file = 'test.in'
output_file = 'test.out'
# input_file = sys.argv[1]
# output_file = sys.argv[2]
pattern = re.compile(r'^[1-9a-fA-F][0-9a-fA-F]*$')
with open(output_file, 'w') as readed_output_file:
with open(input_file, 'r') as readed_input_file:
for row_input_file in readed_input_file:
if pattern.search(row_input_file):
write_answer('yes')
else:
write_answer('no')

12
TaskE10/test.out Normal file
View File

@ -0,0 +1,12 @@
no
no
no
yes
yes
yes
no
yes
yes
yes
yes
yes

20
TaskE12/run.py Normal file
View File

@ -0,0 +1,20 @@
import sys
import re
def write_answer(answer):
with open(output_file, 'a') as file:
file.write(answer+'\n')
# input_file = 'test.in'
# output_file = 'test.out'
input_file = sys.argv[1]
output_file = sys.argv[2]
pattern = re.compile(r'^(?!1-500-56773-4323)\d-\d{3}-\d{5}-\d{4}$')
with open(output_file, 'w') as readed_output_file:
with open(input_file, 'r') as readed_input_file:
for row_input_file in readed_input_file:
if pattern.match(row_input_file):
write_answer('yes')
else:
write_answer('no')

6
TaskE12/test.out Normal file
View File

@ -0,0 +1,6 @@
no
yes
yes
no
yes
yes

30
TaskE13/run.py Normal file
View File

@ -0,0 +1,30 @@
import sys
import re
def write_answer(answer):
with open(output_file, 'a') as file:
file.write(answer+'\n')
input_file = 'test.in'
output_file = 'test.out'
# input_file = sys.argv[1]
# output_file = sys.argv[2]
# pattern = re.compile(r'^[0-9]')
pattern = re.compile(r'^(?!)\d-\d{3}-\d{5}-\d{4}$')
# 46773 4323
# 2 - ABC
# 3 - DEF
# 4 - GHI
# 5 - JKL
# 6 - MNO
# 7 - PQRS
# 8 - TUV
# 9 - WXYZ
with open(output_file, 'w') as readed_output_file:
with open(input_file, 'r') as readed_input_file:
for row_input_file in readed_input_file:
if pattern.match(row_input_file):
write_answer('yes')
else:
write_answer('no')