Add Task-G

This commit is contained in:
slk 2024-01-18 08:56:14 -08:00
parent 013cf7f822
commit 322c4561dd
16 changed files with 712128 additions and 0 deletions

21
TaskF00/description.txt Normal file
View File

@ -0,0 +1,21 @@
Napisać program, który wczytuje kolejne wiersze ze standardowego
wejścia i analizuje każdy wiersz (bez znaku końca wiersza). Należy w
jak największym stopniu wykorzystać wyrażenia regularne (np. nie wolno
użyć negacji jako operacji w danym języku programowania, jeśli da się
to wyrazić w samym wyrażeniu regularnym). Tam, gdzie to możliwe należy
użyć pojedynczego wyrażenia regularnego.
Write a program, which loads consecutive lines from standard input
and analyze every line (with no newline character). You should
use regular expressions to the greatest extent possible (e.g. you
can not use negation in the programming language if it is
possible to express the same in regular expression). Wherever possible,
use one regular expression.
Write a program to substitute all 4-digits string to 4-characters string.
In the substituted string "0" should change to "a", "1" should change to "b", "2" should change to "c", etc.
E.g. "1162" should change to "bbgc".
In this task digit means [0-9] class.
POINTS: 2
DEADLINE: 2024-01-07 23:59:59

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

0
TaskF00/run.py Normal file
View File

3
TaskF00/simple.exp Normal file
View File

@ -0,0 +1,3 @@
dece 34 dfd gfd 5
f33sdfsdbcdedsfsdf
3r

3
TaskF00/simple.in.txt Normal file
View File

@ -0,0 +1,3 @@
3424 34 dfd gfd 5
f33sdfsd1234dsfsdf
3r

23
TaskG00/description.txt Normal file
View File

@ -0,0 +1,23 @@
Use regular expressions to extract lines containing polish surnames.
Download list of polish male and female surnames from here:
* https://dane.gov.pl/pl/dataset/1681,nazwiska-osob-zyjacych-wystepujace-w-rejestrze-pesel/resource/35279/table?page=1&per_page=20&q=&sort=
* https://dane.gov.pl/pl/dataset/1681,nazwiska-osob-zyjacych-wystepujace-w-rejestrze-pesel/resource/22817/table?page=1&per_page=20&q=&sort=
Extract lines from stdin containing any of the surname.
Look only for surnames in lowercase.
The surname does not have to be surrounded by space or any other special characters.
Don't search for declined forms of surnames.
Check either NFA (e.g. re python library) and DFA (google re2) and compare run speed.
Submit solution based on DFA library.
NOTE: You could extract the polish surnames list, save it to a file, then commit the file to your repository.
NOTE: You may set max_mem to a higher value than the default in re2 library.
POINTS: 3
DEADLINE: 2024-01-27 23:59:59

417640
TaskG00/nazwiska.txt Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

28
TaskG00/run.py Normal file
View File

@ -0,0 +1,28 @@
import re2
def build_surname_regex(surnames):
# Create a regular expression pattern from the list of surnames
pattern = r'\b(?:' + '|'.join(surnames) + r')\b'
return re2.compile(pattern)
def main():
# Load Polish surnames from the file
with open('polish_surnames.txt', 'r', encoding='utf-8') as file:
polish_surnames = [line.strip().lower() for line in file]
# Build a DFA regex pattern from the list of surnames
surname_regex = build_surname_regex(polish_surnames)
while True:
try:
# Read a line from standard input
line = input()
# Check if the line contains any of the Polish surnames
if surname_regex.search(line.lower()):
print(line)
except EOFError:
break
if __name__ == "__main__":
main()

8
TaskG04/description.txt Normal file
View File

@ -0,0 +1,8 @@
Na wejściu dostajemy bajty tekstu UTF-8 zapisane w zwykłej postaci tekstu
(Zatem obługujemy strumień wejścia z 0 i 1 w postaci tekstowej, a nie strumień bitów).
Przekonwertuj plik na tekst UTF-8.
POINTS: 2
DEADLINE: 2024-01-21 23:59:59
REMAINDER: 0/2

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

0
TaskG04/run.py Normal file
View File

1
TaskX02/simple.out Normal file
View File

@ -0,0 +1 @@
3