Task 3 and 5 are done
This commit is contained in:
parent
36497ec462
commit
fe8e030279
39 changed files with 2846 additions and 1005424 deletions
73
2025.05.23/03Ex/error.txt
Normal file
73
2025.05.23/03Ex/error.txt
Normal file
|
@ -0,0 +1,73 @@
|
|||
Задача: 1 | Файл: test1.txt | Ошибка: Исполняемый файл ./a01.out не найден
|
||||
Задача: 1 | Файл: test2.txt | Ошибка: Исполняемый файл ./a01.out не найден
|
||||
Задача: 1 | Файл: test3.txt | Ошибка: Исполняемый файл ./a01.out не найден
|
||||
Задача: 1 | Файл: test4.txt | Ошибка: Исполняемый файл ./a01.out не найден
|
||||
Задача: 1 | Файл: test5.txt | Ошибка: Исполняемый файл ./a01.out не найден
|
||||
Задача: 1 | Файл: test6.txt | Ошибка: Исполняемый файл ./a01.out не найден
|
||||
Задача: 1 | Файл: test7.txt | Ошибка: Исполняемый файл ./a01.out не найден
|
||||
Задача: 1 | Файл: test8.txt | Ошибка: Исполняемый файл ./a01.out не найден
|
||||
Задача: 2 | Файл: test1.txt | Ошибка: Исполняемый файл ./a02.out не найден
|
||||
Задача: 2 | Файл: test2.txt | Ошибка: Исполняемый файл ./a02.out не найден
|
||||
Задача: 2 | Файл: test3.txt | Ошибка: Исполняемый файл ./a02.out не найден
|
||||
Задача: 2 | Файл: test4.txt | Ошибка: Исполняемый файл ./a02.out не найден
|
||||
Задача: 2 | Файл: test5.txt | Ошибка: Исполняемый файл ./a02.out не найден
|
||||
Задача: 2 | Файл: test6.txt | Ошибка: Исполняемый файл ./a02.out не найден
|
||||
Задача: 2 | Файл: test7.txt | Ошибка: Исполняемый файл ./a02.out не найден
|
||||
Задача: 2 | Файл: test8.txt | Ошибка: Исполняемый файл ./a02.out не найден
|
||||
Задача: 3 | Файл: test6.txt | Ошибка: Программа завершилась с кодом 254
|
||||
Задача: 4 | Файл: test1.txt | Ошибка: Исполняемый файл ./a04.out не найден
|
||||
Задача: 4 | Файл: test2.txt | Ошибка: Исполняемый файл ./a04.out не найден
|
||||
Задача: 4 | Файл: test3.txt | Ошибка: Исполняемый файл ./a04.out не найден
|
||||
Задача: 4 | Файл: test4.txt | Ошибка: Исполняемый файл ./a04.out не найден
|
||||
Задача: 4 | Файл: test5.txt | Ошибка: Исполняемый файл ./a04.out не найден
|
||||
Задача: 4 | Файл: test6.txt | Ошибка: Исполняемый файл ./a04.out не найден
|
||||
Задача: 4 | Файл: test7.txt | Ошибка: Исполняемый файл ./a04.out не найден
|
||||
Задача: 4 | Файл: test8.txt | Ошибка: Исполняемый файл ./a04.out не найден
|
||||
Задача: 5 | Файл: test1.txt | Ошибка: Исполняемый файл ./a05.out не найден
|
||||
Задача: 5 | Файл: test2.txt | Ошибка: Исполняемый файл ./a05.out не найден
|
||||
Задача: 5 | Файл: test3.txt | Ошибка: Исполняемый файл ./a05.out не найден
|
||||
Задача: 5 | Файл: test4.txt | Ошибка: Исполняемый файл ./a05.out не найден
|
||||
Задача: 5 | Файл: test5.txt | Ошибка: Исполняемый файл ./a05.out не найден
|
||||
Задача: 5 | Файл: test6.txt | Ошибка: Исполняемый файл ./a05.out не найден
|
||||
Задача: 5 | Файл: test7.txt | Ошибка: Исполняемый файл ./a05.out не найден
|
||||
Задача: 5 | Файл: test8.txt | Ошибка: Исполняемый файл ./a05.out не найден
|
||||
Задача: 6 | Файл: test1.txt | Ошибка: Исполняемый файл ./a06.out не найден
|
||||
Задача: 6 | Файл: test2.txt | Ошибка: Исполняемый файл ./a06.out не найден
|
||||
Задача: 6 | Файл: test3.txt | Ошибка: Исполняемый файл ./a06.out не найден
|
||||
Задача: 6 | Файл: test4.txt | Ошибка: Исполняемый файл ./a06.out не найден
|
||||
Задача: 6 | Файл: test5.txt | Ошибка: Исполняемый файл ./a06.out не найден
|
||||
Задача: 6 | Файл: test6.txt | Ошибка: Исполняемый файл ./a06.out не найден
|
||||
Задача: 6 | Файл: test7.txt | Ошибка: Исполняемый файл ./a06.out не найден
|
||||
Задача: 6 | Файл: test8.txt | Ошибка: Исполняемый файл ./a06.out не найден
|
||||
Задача: 7 | Файл: test1.txt | Ошибка: Исполняемый файл ./a07.out не найден
|
||||
Задача: 7 | Файл: test2.txt | Ошибка: Исполняемый файл ./a07.out не найден
|
||||
Задача: 7 | Файл: test3.txt | Ошибка: Исполняемый файл ./a07.out не найден
|
||||
Задача: 7 | Файл: test4.txt | Ошибка: Исполняемый файл ./a07.out не найден
|
||||
Задача: 7 | Файл: test5.txt | Ошибка: Исполняемый файл ./a07.out не найден
|
||||
Задача: 7 | Файл: test6.txt | Ошибка: Исполняемый файл ./a07.out не найден
|
||||
Задача: 7 | Файл: test7.txt | Ошибка: Исполняемый файл ./a07.out не найден
|
||||
Задача: 7 | Файл: test8.txt | Ошибка: Исполняемый файл ./a07.out не найден
|
||||
Задача: 8 | Файл: test1.txt | Ошибка: Исполняемый файл ./a08.out не найден
|
||||
Задача: 8 | Файл: test2.txt | Ошибка: Исполняемый файл ./a08.out не найден
|
||||
Задача: 8 | Файл: test3.txt | Ошибка: Исполняемый файл ./a08.out не найден
|
||||
Задача: 8 | Файл: test4.txt | Ошибка: Исполняемый файл ./a08.out не найден
|
||||
Задача: 8 | Файл: test5.txt | Ошибка: Исполняемый файл ./a08.out не найден
|
||||
Задача: 8 | Файл: test6.txt | Ошибка: Исполняемый файл ./a08.out не найден
|
||||
Задача: 8 | Файл: test7.txt | Ошибка: Исполняемый файл ./a08.out не найден
|
||||
Задача: 8 | Файл: test8.txt | Ошибка: Исполняемый файл ./a08.out не найден
|
||||
Задача: 9 | Файл: test1.txt | Ошибка: Исполняемый файл ./a09.out не найден
|
||||
Задача: 9 | Файл: test2.txt | Ошибка: Исполняемый файл ./a09.out не найден
|
||||
Задача: 9 | Файл: test3.txt | Ошибка: Исполняемый файл ./a09.out не найден
|
||||
Задача: 9 | Файл: test4.txt | Ошибка: Исполняемый файл ./a09.out не найден
|
||||
Задача: 9 | Файл: test5.txt | Ошибка: Исполняемый файл ./a09.out не найден
|
||||
Задача: 9 | Файл: test6.txt | Ошибка: Исполняемый файл ./a09.out не найден
|
||||
Задача: 9 | Файл: test7.txt | Ошибка: Исполняемый файл ./a09.out не найден
|
||||
Задача: 9 | Файл: test8.txt | Ошибка: Исполняемый файл ./a09.out не найден
|
||||
Задача: 10 | Файл: test1.txt | Ошибка: Исполняемый файл ./a10.out не найден
|
||||
Задача: 10 | Файл: test2.txt | Ошибка: Исполняемый файл ./a10.out не найден
|
||||
Задача: 10 | Файл: test3.txt | Ошибка: Исполняемый файл ./a10.out не найден
|
||||
Задача: 10 | Файл: test4.txt | Ошибка: Исполняемый файл ./a10.out не найден
|
||||
Задача: 10 | Файл: test5.txt | Ошибка: Исполняемый файл ./a10.out не найден
|
||||
Задача: 10 | Файл: test6.txt | Ошибка: Исполняемый файл ./a10.out не найден
|
||||
Задача: 10 | Файл: test7.txt | Ошибка: Исполняемый файл ./a10.out не найден
|
||||
Задача: 10 | Файл: test8.txt | Ошибка: Исполняемый файл ./a10.out не найден
|
9
2025.05.23/03Ex/input/6.txt
Normal file
9
2025.05.23/03Ex/input/6.txt
Normal file
|
@ -0,0 +1,9 @@
|
|||
a
|
||||
a
|
||||
a
|
||||
ab
|
||||
ab
|
||||
ab
|
||||
ab
|
||||
abc
|
||||
abc
|
433
2025.05.23/03Ex/res.txt
Normal file
433
2025.05.23/03Ex/res.txt
Normal file
|
@ -0,0 +1,433 @@
|
|||
=================
|
||||
=== ЗАДАЧА 1 ===
|
||||
=================
|
||||
Тестируемый файл: test1.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a01.out не найден!
|
||||
|
||||
Тестируемый файл: test2.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a01.out не найден!
|
||||
|
||||
Тестируемый файл: test3.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a01.out не найден!
|
||||
|
||||
Тестируемый файл: test4.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a01.out не найден!
|
||||
|
||||
Тестируемый файл: test5.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a01.out не найден!
|
||||
|
||||
Тестируемый файл: test6.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a01.out не найден!
|
||||
|
||||
Тестируемый файл: test7.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a01.out не найден!
|
||||
|
||||
Тестируемый файл: test8.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a01.out не найден!
|
||||
|
||||
|
||||
=================
|
||||
=== ЗАДАЧА 2 ===
|
||||
=================
|
||||
Тестируемый файл: test1.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a02.out не найден!
|
||||
|
||||
Тестируемый файл: test2.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a02.out не найден!
|
||||
|
||||
Тестируемый файл: test3.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a02.out не найден!
|
||||
|
||||
Тестируемый файл: test4.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a02.out не найден!
|
||||
|
||||
Тестируемый файл: test5.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a02.out не найден!
|
||||
|
||||
Тестируемый файл: test6.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a02.out не найден!
|
||||
|
||||
Тестируемый файл: test7.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a02.out не найден!
|
||||
|
||||
Тестируемый файл: test8.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a02.out не найден!
|
||||
|
||||
|
||||
=================
|
||||
=== ЗАДАЧА 3 ===
|
||||
=================
|
||||
Тестируемый файл: test1.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a03.out 5 test1.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
apple
|
||||
banana
|
||||
apple
|
||||
cherry
|
||||
date
|
||||
./a03.out : Task = 3 Result = 2 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test2.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a03.out 5 test2.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.01
|
||||
one
|
||||
one
|
||||
two
|
||||
two
|
||||
two
|
||||
./a03.out : Task = 3 Result = 3 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test3.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a03.out 5 test3.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
a
|
||||
b
|
||||
c
|
||||
d
|
||||
e
|
||||
./a03.out : Task = 3 Result = 0 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test4.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a03.out 5 test4.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.01
|
||||
h
|
||||
g
|
||||
f
|
||||
e
|
||||
d
|
||||
./a03.out : Task = 3 Result = 0 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test5.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a03.out 5 test5.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
cat
|
||||
dog
|
||||
cat
|
||||
bird
|
||||
fish
|
||||
./a03.out : Task = 3 Result = 3 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test6.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a03.out 5 test6.txt
|
||||
ОШИБКА: Программа завершилась с кодом 254
|
||||
|
||||
Тестируемый файл: test7.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a03.out 5 test7.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 2 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
single
|
||||
./a03.out : Task = 3 Result = 0 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test8.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a03.out 5 test8.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 6 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
very_long_string_1234567890
|
||||
short
|
||||
medium_length_string_123
|
||||
./a03.out : Task = 3 Result = 0 Elapsed = 0.00
|
||||
|
||||
|
||||
=================
|
||||
=== ЗАДАЧА 4 ===
|
||||
=================
|
||||
Тестируемый файл: test1.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a04.out не найден!
|
||||
|
||||
Тестируемый файл: test2.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a04.out не найден!
|
||||
|
||||
Тестируемый файл: test3.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a04.out не найден!
|
||||
|
||||
Тестируемый файл: test4.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a04.out не найден!
|
||||
|
||||
Тестируемый файл: test5.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a04.out не найден!
|
||||
|
||||
Тестируемый файл: test6.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a04.out не найден!
|
||||
|
||||
Тестируемый файл: test7.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a04.out не найден!
|
||||
|
||||
Тестируемый файл: test8.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a04.out не найден!
|
||||
|
||||
|
||||
=================
|
||||
=== ЗАДАЧА 5 ===
|
||||
=================
|
||||
Тестируемый файл: test1.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a05.out не найден!
|
||||
|
||||
Тестируемый файл: test2.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a05.out не найден!
|
||||
|
||||
Тестируемый файл: test3.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a05.out не найден!
|
||||
|
||||
Тестируемый файл: test4.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a05.out не найден!
|
||||
|
||||
Тестируемый файл: test5.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a05.out не найден!
|
||||
|
||||
Тестируемый файл: test6.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a05.out не найден!
|
||||
|
||||
Тестируемый файл: test7.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a05.out не найден!
|
||||
|
||||
Тестируемый файл: test8.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a05.out не найден!
|
||||
|
||||
|
||||
=================
|
||||
=== ЗАДАЧА 6 ===
|
||||
=================
|
||||
Тестируемый файл: test1.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a06.out не найден!
|
||||
|
||||
Тестируемый файл: test2.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a06.out не найден!
|
||||
|
||||
Тестируемый файл: test3.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a06.out не найден!
|
||||
|
||||
Тестируемый файл: test4.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a06.out не найден!
|
||||
|
||||
Тестируемый файл: test5.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a06.out не найден!
|
||||
|
||||
Тестируемый файл: test6.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a06.out не найден!
|
||||
|
||||
Тестируемый файл: test7.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a06.out не найден!
|
||||
|
||||
Тестируемый файл: test8.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a06.out не найден!
|
||||
|
||||
|
||||
=================
|
||||
=== ЗАДАЧА 7 ===
|
||||
=================
|
||||
Тестируемый файл: test1.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a07.out не найден!
|
||||
|
||||
Тестируемый файл: test2.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a07.out не найден!
|
||||
|
||||
Тестируемый файл: test3.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a07.out не найден!
|
||||
|
||||
Тестируемый файл: test4.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a07.out не найден!
|
||||
|
||||
Тестируемый файл: test5.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a07.out не найден!
|
||||
|
||||
Тестируемый файл: test6.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a07.out не найден!
|
||||
|
||||
Тестируемый файл: test7.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a07.out не найден!
|
||||
|
||||
Тестируемый файл: test8.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a07.out не найден!
|
||||
|
||||
|
||||
=================
|
||||
=== ЗАДАЧА 8 ===
|
||||
=================
|
||||
Тестируемый файл: test1.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a08.out не найден!
|
||||
|
||||
Тестируемый файл: test2.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a08.out не найден!
|
||||
|
||||
Тестируемый файл: test3.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a08.out не найден!
|
||||
|
||||
Тестируемый файл: test4.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a08.out не найден!
|
||||
|
||||
Тестируемый файл: test5.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a08.out не найден!
|
||||
|
||||
Тестируемый файл: test6.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a08.out не найден!
|
||||
|
||||
Тестируемый файл: test7.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a08.out не найден!
|
||||
|
||||
Тестируемый файл: test8.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a08.out не найден!
|
||||
|
||||
|
||||
=================
|
||||
=== ЗАДАЧА 9 ===
|
||||
=================
|
||||
Тестируемый файл: test1.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a09.out не найден!
|
||||
|
||||
Тестируемый файл: test2.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a09.out не найден!
|
||||
|
||||
Тестируемый файл: test3.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a09.out не найден!
|
||||
|
||||
Тестируемый файл: test4.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a09.out не найден!
|
||||
|
||||
Тестируемый файл: test5.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a09.out не найден!
|
||||
|
||||
Тестируемый файл: test6.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a09.out не найден!
|
||||
|
||||
Тестируемый файл: test7.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a09.out не найден!
|
||||
|
||||
Тестируемый файл: test8.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a09.out не найден!
|
||||
|
||||
|
||||
=================
|
||||
=== ЗАДАЧА 10 ===
|
||||
=================
|
||||
Тестируемый файл: test1.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a10.out не найден!
|
||||
|
||||
Тестируемый файл: test2.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a10.out не найден!
|
||||
|
||||
Тестируемый файл: test3.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a10.out не найден!
|
||||
|
||||
Тестируемый файл: test4.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a10.out не найден!
|
||||
|
||||
Тестируемый файл: test5.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a10.out не найден!
|
||||
|
||||
Тестируемый файл: test6.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a10.out не найден!
|
||||
|
||||
Тестируемый файл: test7.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a10.out не найден!
|
||||
|
||||
Тестируемый файл: test8.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Исполняемый файл ./a10.out не найден!
|
||||
|
||||
|
||||
Найдено ошибок: 73
|
|
@ -31,7 +31,9 @@ int t3_solve (node *head)
|
|||
local = 0;
|
||||
} else
|
||||
local++;
|
||||
}
|
||||
} else
|
||||
if (cmp_next >= 0)
|
||||
local = 1;
|
||||
} else {
|
||||
count += local;
|
||||
local = 0;
|
||||
|
|
|
@ -24,6 +24,9 @@ int t5_solve (node *head)
|
|||
|
||||
if (maximum < count)
|
||||
maximum = count;
|
||||
|
||||
if (maximum == 1)
|
||||
maximum = 0;
|
||||
|
||||
return maximum;
|
||||
}
|
||||
|
|
1004879
2025.05.23/10Ex/input/big_a.txt
1004879
2025.05.23/10Ex/input/big_a.txt
File diff suppressed because it is too large
Load diff
39
2025.05.23/dist/Kochubei_DS/Makefile
vendored
Normal file
39
2025.05.23/dist/Kochubei_DS/Makefile
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
OPTS = -mfpmath=sse -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -Wmaybe-uninitialized -Wempty-body -Wlogical-op -Wold-style-declaration -Wmissing-parameter-type -Wignored-qualifiers -Winit-self -Wshadow -Wtype-limits -Wstrict-prototypes -Wmissing-field-initializers -Wno-pointer-sign -Wswitch-default -O3 -lm
|
||||
|
||||
|
||||
all: a01.out a02.out a03.out a04.out a05.out a06.out a07.out a08.out a09.out a10.out
|
||||
|
||||
%.o: %.c
|
||||
gcc -c $(OPTS) $<
|
||||
|
||||
%.out: %.o
|
||||
gcc $(OPTS) $^ -o $@
|
||||
|
||||
solve.o: solve.c solve.h
|
||||
add.o: add.c add.h
|
||||
|
||||
a01.o: a01.c solve.h add.h
|
||||
a02.o: a02.c solve.h add.h
|
||||
a03.o: a03.c solve.h add.h
|
||||
a04.o: a04.c solve.h add.h
|
||||
a05.o: a05.c solve.h add.h
|
||||
a06.o: a06.c solve.h add.h
|
||||
a07.o: a07.c solve.h add.h
|
||||
a08.o: a08.c solve.h add.h
|
||||
a09.o: a09.c solve.h add.h
|
||||
a10.o: a10.c solve.h add.h
|
||||
|
||||
a01.out: a01.o solve.o add.o
|
||||
a02.out: a02.o solve.o add.o
|
||||
a03.out: a03.o solve.o add.o
|
||||
a04.out: a04.o solve.o add.o
|
||||
a05.out: a05.o solve.o add.o
|
||||
a06.out: a06.o solve.o add.o
|
||||
a07.out: a07.o solve.o add.o
|
||||
a08.out: a08.o solve.o add.o
|
||||
a09.out: a09.o solve.o add.o
|
||||
a10.out: a10.o solve.o add.o
|
||||
|
||||
|
||||
clean:
|
||||
rm *.o *.out
|
51
2025.05.23/dist/Kochubei_DS/a01.c
vendored
Normal file
51
2025.05.23/dist/Kochubei_DS/a01.c
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include "solve.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int p=0;
|
||||
int res=0;
|
||||
double t=0;
|
||||
char* name;
|
||||
node* N;
|
||||
int status=0;
|
||||
if (argc!=3)
|
||||
{
|
||||
printf("Usage: %s p name\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
if (sscanf(argv[1], "%d", &p)!=1)
|
||||
{
|
||||
printf("Usage: %s p name\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
name=argv[2];
|
||||
status=read_node(&N, name);
|
||||
if (status==-1)
|
||||
{
|
||||
printf("Cannot open file\n");
|
||||
delete_node(N);
|
||||
return -1;
|
||||
}
|
||||
else if (status==-2)
|
||||
{
|
||||
printf("Cannot read file\n");
|
||||
delete_node(N);
|
||||
return -2;
|
||||
}
|
||||
else if (status==3)
|
||||
{
|
||||
printf("Cannot allocate memory\n");
|
||||
delete_node(N);
|
||||
return -2;
|
||||
}
|
||||
print_node(p, N);
|
||||
t=clock();
|
||||
res=solve1(N);
|
||||
t=(clock()-t)/CLOCKS_PER_SEC;
|
||||
printf ("%s : Task = %d Result = %d Elapsed = %.2f\n", argv[0], 1, res, t);
|
||||
delete_node(N);
|
||||
return 0;
|
||||
}
|
51
2025.05.23/dist/Kochubei_DS/a02.c
vendored
Normal file
51
2025.05.23/dist/Kochubei_DS/a02.c
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include "solve.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int p=0;
|
||||
int res=0;
|
||||
double t=0;
|
||||
char* name;
|
||||
node* N;
|
||||
int status=0;
|
||||
if (argc!=3)
|
||||
{
|
||||
printf("Usage: %s p name\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
if (sscanf(argv[1], "%d", &p)!=1)
|
||||
{
|
||||
printf("Usage: %s p name\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
name=argv[2];
|
||||
status=read_node(&N, name);
|
||||
if (status==-1)
|
||||
{
|
||||
printf("Cannot open file\n");
|
||||
delete_node(N);
|
||||
return -1;
|
||||
}
|
||||
else if (status==-2)
|
||||
{
|
||||
printf("Cannot read file\n");
|
||||
delete_node(N);
|
||||
return -2;
|
||||
}
|
||||
else if (status==3)
|
||||
{
|
||||
printf("Cannot allocate memory\n");
|
||||
delete_node(N);
|
||||
return -2;
|
||||
}
|
||||
print_node(p, N);
|
||||
t=clock();
|
||||
res=solve2(N);
|
||||
t=(clock()-t)/CLOCKS_PER_SEC;
|
||||
printf ("%s : Task = %d Result = %d Elapsed = %.2f\n", argv[0], 2, res, t);
|
||||
delete_node(N);
|
||||
return 0;
|
||||
}
|
51
2025.05.23/dist/Kochubei_DS/a03.c
vendored
Normal file
51
2025.05.23/dist/Kochubei_DS/a03.c
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include "solve.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int p=0;
|
||||
int res=0;
|
||||
double t=0;
|
||||
char* name;
|
||||
node* N;
|
||||
int status=0;
|
||||
if (argc!=3)
|
||||
{
|
||||
printf("Usage: %s p name\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
if (sscanf(argv[1], "%d", &p)!=1)
|
||||
{
|
||||
printf("Usage: %s p name\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
name=argv[2];
|
||||
status=read_node(&N, name);
|
||||
if (status==-1)
|
||||
{
|
||||
printf("Cannot open file\n");
|
||||
delete_node(N);
|
||||
return -1;
|
||||
}
|
||||
else if (status==-2)
|
||||
{
|
||||
printf("Cannot read file\n");
|
||||
delete_node(N);
|
||||
return -2;
|
||||
}
|
||||
else if (status==3)
|
||||
{
|
||||
printf("Cannot allocate memory\n");
|
||||
delete_node(N);
|
||||
return -2;
|
||||
}
|
||||
print_node(p, N);
|
||||
t=clock();
|
||||
res=solve3(N);
|
||||
t=(clock()-t)/CLOCKS_PER_SEC;
|
||||
printf ("%s : Task = %d Result = %d Elapsed = %.2f\n", argv[0], 3, res, t);
|
||||
delete_node(N);
|
||||
return 0;
|
||||
}
|
51
2025.05.23/dist/Kochubei_DS/a04.c
vendored
Normal file
51
2025.05.23/dist/Kochubei_DS/a04.c
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include "solve.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int p=0;
|
||||
int res=0;
|
||||
double t=0;
|
||||
char* name;
|
||||
node* N;
|
||||
int status=0;
|
||||
if (argc!=3)
|
||||
{
|
||||
printf("Usage: %s p name\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
if (sscanf(argv[1], "%d", &p)!=1)
|
||||
{
|
||||
printf("Usage: %s p name\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
name=argv[2];
|
||||
status=read_node(&N, name);
|
||||
if (status==-1)
|
||||
{
|
||||
printf("Cannot open file\n");
|
||||
delete_node(N);
|
||||
return -1;
|
||||
}
|
||||
else if (status==-2)
|
||||
{
|
||||
printf("Cannot read file\n");
|
||||
delete_node(N);
|
||||
return -2;
|
||||
}
|
||||
else if (status==3)
|
||||
{
|
||||
printf("Cannot allocate memory\n");
|
||||
delete_node(N);
|
||||
return -2;
|
||||
}
|
||||
print_node(p, N);
|
||||
t=clock();
|
||||
res=solve4(N);
|
||||
t=(clock()-t)/CLOCKS_PER_SEC;
|
||||
printf ("%s : Task = %d Result = %d Elapsed = %.2f\n", argv[0], 4, res, t);
|
||||
delete_node(N);
|
||||
return 0;
|
||||
}
|
51
2025.05.23/dist/Kochubei_DS/a05.c
vendored
Normal file
51
2025.05.23/dist/Kochubei_DS/a05.c
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include "solve.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int p=0;
|
||||
int res=0;
|
||||
double t=0;
|
||||
char* name;
|
||||
node* N;
|
||||
int status=0;
|
||||
if (argc!=3)
|
||||
{
|
||||
printf("Usage: %s p name\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
if (sscanf(argv[1], "%d", &p)!=1)
|
||||
{
|
||||
printf("Usage: %s p name\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
name=argv[2];
|
||||
status=read_node(&N, name);
|
||||
if (status==-1)
|
||||
{
|
||||
printf("Cannot open file\n");
|
||||
delete_node(N);
|
||||
return -1;
|
||||
}
|
||||
else if (status==-2)
|
||||
{
|
||||
printf("Cannot read file\n");
|
||||
delete_node(N);
|
||||
return -2;
|
||||
}
|
||||
else if (status==3)
|
||||
{
|
||||
printf("Cannot allocate memory\n");
|
||||
delete_node(N);
|
||||
return -2;
|
||||
}
|
||||
print_node(p, N);
|
||||
t=clock();
|
||||
res=solve5(N);
|
||||
t=(clock()-t)/CLOCKS_PER_SEC;
|
||||
printf ("%s : Task = %d Result = %d Elapsed = %.2f\n", argv[0], 5, res, t);
|
||||
delete_node(N);
|
||||
return 0;
|
||||
}
|
51
2025.05.23/dist/Kochubei_DS/a06.c
vendored
Normal file
51
2025.05.23/dist/Kochubei_DS/a06.c
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include "solve.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int p=0;
|
||||
int res=0;
|
||||
double t=0;
|
||||
char* name;
|
||||
node* N;
|
||||
int status=0;
|
||||
if (argc!=3)
|
||||
{
|
||||
printf("Usage: %s p name\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
if (sscanf(argv[1], "%d", &p)!=1)
|
||||
{
|
||||
printf("Usage: %s p name\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
name=argv[2];
|
||||
status=read_node(&N, name);
|
||||
if (status==-1)
|
||||
{
|
||||
printf("Cannot open file\n");
|
||||
delete_node(N);
|
||||
return -1;
|
||||
}
|
||||
else if (status==-2)
|
||||
{
|
||||
printf("Cannot read file\n");
|
||||
delete_node(N);
|
||||
return -2;
|
||||
}
|
||||
else if (status==3)
|
||||
{
|
||||
printf("Cannot allocate memory\n");
|
||||
delete_node(N);
|
||||
return -2;
|
||||
}
|
||||
print_node(p, N);
|
||||
t=clock();
|
||||
res=solve6(N);
|
||||
t=(clock()-t)/CLOCKS_PER_SEC;
|
||||
printf ("%s : Task = %d Result = %d Elapsed = %.2f\n", argv[0], 6, res, t);
|
||||
delete_node(N);
|
||||
return 0;
|
||||
}
|
51
2025.05.23/dist/Kochubei_DS/a07.c
vendored
Normal file
51
2025.05.23/dist/Kochubei_DS/a07.c
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include "solve.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int p=0;
|
||||
int res=0;
|
||||
double t=0;
|
||||
char* name;
|
||||
node* N;
|
||||
int status=0;
|
||||
if (argc!=3)
|
||||
{
|
||||
printf("Usage: %s p name\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
if (sscanf(argv[1], "%d", &p)!=1)
|
||||
{
|
||||
printf("Usage: %s p name\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
name=argv[2];
|
||||
status=read_node(&N, name);
|
||||
if (status==-1)
|
||||
{
|
||||
printf("Cannot open file\n");
|
||||
delete_node(N);
|
||||
return -1;
|
||||
}
|
||||
else if (status==-2)
|
||||
{
|
||||
printf("Cannot read file\n");
|
||||
delete_node(N);
|
||||
return -2;
|
||||
}
|
||||
else if (status==3)
|
||||
{
|
||||
printf("Cannot allocate memory\n");
|
||||
delete_node(N);
|
||||
return -2;
|
||||
}
|
||||
print_node(p, N);
|
||||
t=clock();
|
||||
res=solve7(N);
|
||||
t=(clock()-t)/CLOCKS_PER_SEC;
|
||||
printf ("%s : Task = %d Result = %d Elapsed = %.2f\n", argv[0], 7, res, t);
|
||||
delete_node(N);
|
||||
return 0;
|
||||
}
|
53
2025.05.23/dist/Kochubei_DS/a08.c
vendored
Normal file
53
2025.05.23/dist/Kochubei_DS/a08.c
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include "solve.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int p=0;
|
||||
int len=0;
|
||||
double t=0;
|
||||
char* name;
|
||||
node* N;
|
||||
int status=0;
|
||||
if (argc!=3)
|
||||
{
|
||||
printf("Usage: %s p name\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
if (sscanf(argv[1], "%d", &p)!=1)
|
||||
{
|
||||
printf("Usage: %s p name\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
name=argv[2];
|
||||
status=read_node(&N, name);
|
||||
if (status==-1)
|
||||
{
|
||||
printf("Cannot open file\n");
|
||||
delete_node(N);
|
||||
return -1;
|
||||
}
|
||||
else if (status==-2)
|
||||
{
|
||||
printf("Cannot read file\n");
|
||||
delete_node(N);
|
||||
return -2;
|
||||
}
|
||||
else if (status==3)
|
||||
{
|
||||
printf("Cannot allocate memory\n");
|
||||
delete_node(N);
|
||||
return -2;
|
||||
}
|
||||
print_node(p, N);
|
||||
t=clock();
|
||||
N=solve8(N);
|
||||
t=(clock()-t)/CLOCKS_PER_SEC;
|
||||
len=node_len(N);
|
||||
print_node(p, N);
|
||||
printf ("%s : Task = %d Length = %d Elapsed = %.2f\n", argv[0], 8, len, t);
|
||||
delete_node(N);
|
||||
return 0;
|
||||
}
|
53
2025.05.23/dist/Kochubei_DS/a09.c
vendored
Normal file
53
2025.05.23/dist/Kochubei_DS/a09.c
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include "solve.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int p=0;
|
||||
int len=0;
|
||||
double t=0;
|
||||
char* name;
|
||||
node* N;
|
||||
int status=0;
|
||||
if (argc!=3)
|
||||
{
|
||||
printf("Usage: %s p name\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
if (sscanf(argv[1], "%d", &p)!=1)
|
||||
{
|
||||
printf("Usage: %s p name\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
name=argv[2];
|
||||
status=read_node(&N, name);
|
||||
if (status==-1)
|
||||
{
|
||||
printf("Cannot open file\n");
|
||||
delete_node(N);
|
||||
return -1;
|
||||
}
|
||||
else if (status==-2)
|
||||
{
|
||||
printf("Cannot read file\n");
|
||||
delete_node(N);
|
||||
return -2;
|
||||
}
|
||||
else if (status==3)
|
||||
{
|
||||
printf("Cannot allocate memory\n");
|
||||
delete_node(N);
|
||||
return -2;
|
||||
}
|
||||
print_node(p, N);
|
||||
t=clock();
|
||||
N=solve9(N);
|
||||
t=(clock()-t)/CLOCKS_PER_SEC;
|
||||
len=node_len(N);
|
||||
print_node(p, N);
|
||||
printf ("%s : Task = %d Length = %d Elapsed = %.2f\n", argv[0], 9, len, t);
|
||||
delete_node(N);
|
||||
return 0;
|
||||
}
|
53
2025.05.23/dist/Kochubei_DS/a10.c
vendored
Normal file
53
2025.05.23/dist/Kochubei_DS/a10.c
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include "solve.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int p=0;
|
||||
int len=0;
|
||||
double t=0;
|
||||
char* name;
|
||||
node* N;
|
||||
int status=0;
|
||||
if (argc!=3)
|
||||
{
|
||||
printf("Usage: %s p name\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
if (sscanf(argv[1], "%d", &p)!=1)
|
||||
{
|
||||
printf("Usage: %s p name\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
name=argv[2];
|
||||
status=read_node(&N, name);
|
||||
if (status==-1)
|
||||
{
|
||||
printf("Cannot open file\n");
|
||||
delete_node(N);
|
||||
return -1;
|
||||
}
|
||||
else if (status==-2)
|
||||
{
|
||||
printf("Cannot read file\n");
|
||||
delete_node(N);
|
||||
return -2;
|
||||
}
|
||||
else if (status==3)
|
||||
{
|
||||
printf("Cannot allocate memory\n");
|
||||
delete_node(N);
|
||||
return -2;
|
||||
}
|
||||
print_node(p, N);
|
||||
t=clock();
|
||||
N=solve10(N);
|
||||
t=(clock()-t)/CLOCKS_PER_SEC;
|
||||
len=node_len(N);
|
||||
print_node(p, N);
|
||||
printf ("%s : Task = %d Length = %d Elapsed = %.2f\n", argv[0], 10, len, t);
|
||||
delete_node(N);
|
||||
return 0;
|
||||
}
|
196
2025.05.23/dist/Kochubei_DS/add.c
vendored
Normal file
196
2025.05.23/dist/Kochubei_DS/add.c
vendored
Normal file
|
@ -0,0 +1,196 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "add.h"
|
||||
|
||||
/*/
|
||||
int read_node(char* name, node* head)
|
||||
{
|
||||
char buf[LEN];
|
||||
node* tmp;
|
||||
FILE* fd;
|
||||
tmp=head;
|
||||
fd=fopen(name, "rt");
|
||||
if (fd==0)
|
||||
{
|
||||
tmp->next=0;
|
||||
return -1;
|
||||
}
|
||||
while(fgets(buf, LEN, fd))
|
||||
{
|
||||
size_t l=0;
|
||||
//printf("BUF: %s\n", buf);
|
||||
l=strlen(buf);
|
||||
if (
|
||||
tmp->string=(char*)malloc((l+1)*sizeof(char));
|
||||
if (tmp->string==0)
|
||||
{
|
||||
fclose(fd);
|
||||
tmp->next=0;
|
||||
return -3;
|
||||
}
|
||||
strcpy(tmp->string, buf);
|
||||
if (!feof(fd))
|
||||
{
|
||||
printf("NOT FEOF: %s\n", tmp->string);
|
||||
tmp->next=(node*)malloc(sizeof(node));
|
||||
if (tmp->next==0)
|
||||
{
|
||||
fclose(fd);
|
||||
tmp->next=0;
|
||||
return -3;
|
||||
}
|
||||
printf("Str: %s\n", tmp->string);
|
||||
tmp=tmp->next;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("FEOF: %s\n", tmp->string);
|
||||
tmp->next=0;
|
||||
return 0;
|
||||
}
|
||||
//size_t l=strcspn(buf, "\n");
|
||||
//buf[l]='\0';
|
||||
size_t l=0;
|
||||
l=strlen(buf);
|
||||
printf("Buf: %s\n", buf);
|
||||
printf("OK\n");
|
||||
tmp->string=(char*)malloc((l+1)*sizeof(char));
|
||||
if (tmp->string==0)
|
||||
{
|
||||
tmp->next=0;
|
||||
delete_node(head);
|
||||
fclose(fd);
|
||||
return -3;
|
||||
}
|
||||
print_node(100, head);
|
||||
strcpy(tmp->string, buf);
|
||||
tmp->next=(node*)malloc(sizeof(node));
|
||||
if (tmp->next==0)
|
||||
{
|
||||
delete_node(head);
|
||||
fclose(fd);
|
||||
return -3;
|
||||
}
|
||||
if (tmp->next==0) break;
|
||||
tmp=tmp->next;
|
||||
}
|
||||
tmp->string=0;
|
||||
fclose(fd);
|
||||
return 0;
|
||||
}
|
||||
/*/
|
||||
|
||||
int read_node(node ** HEAD, const char *name)
|
||||
{
|
||||
char buf[LEN];
|
||||
FILE *fp = 0;
|
||||
node *head;
|
||||
node *tmp;
|
||||
int j;
|
||||
if (!(fp = fopen(name, "r"))) return -1;
|
||||
head = (node*)malloc(sizeof(node));
|
||||
head->next = 0;
|
||||
if (!fgets(buf, LEN, fp))
|
||||
{
|
||||
fclose(fp);
|
||||
free(head);
|
||||
return -2;
|
||||
}
|
||||
for (j = 0; buf[j] && buf[j] != '\n'; j++);
|
||||
buf[j] = '\0';
|
||||
head->string = (char *) malloc((j + 1) * sizeof(char));
|
||||
if (!head->string)
|
||||
{
|
||||
fclose(fp);
|
||||
free(head);
|
||||
return -2;
|
||||
}
|
||||
strcpy(head->string, buf);
|
||||
|
||||
*HEAD = head;
|
||||
|
||||
while (fgets(buf, LEN, fp))
|
||||
{
|
||||
tmp = (node*)malloc(sizeof(node));
|
||||
for (j = 0; buf[j] && buf[j] != '\n'; j++);
|
||||
buf[j] = '\0';
|
||||
tmp->string = (char *) malloc((j + 1) * sizeof(char));
|
||||
if (!head->string)
|
||||
{
|
||||
fclose(fp);
|
||||
free(tmp);
|
||||
delete_node(*HEAD);
|
||||
return -2;
|
||||
}
|
||||
head->next = tmp;
|
||||
head = tmp;
|
||||
strcpy(head->string, buf);
|
||||
head->next = 0;
|
||||
}
|
||||
if (!feof(fp))
|
||||
{
|
||||
fclose(fp);
|
||||
delete_node(*HEAD);
|
||||
return -2;
|
||||
}
|
||||
fclose(fp);
|
||||
return 0;
|
||||
|
||||
}
|
||||
void print_node(int p, node* head)
|
||||
{
|
||||
node* tmp;
|
||||
tmp=head;
|
||||
//printf("%s", head->string);
|
||||
for (int i=0; i<p; i++)
|
||||
{
|
||||
printf("%s\n", tmp->string);
|
||||
if (tmp->next==0) break;
|
||||
tmp=tmp->next;
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void delete_node(node* head)
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
node* pointer;
|
||||
free(head->string);
|
||||
pointer=head;
|
||||
head=head->next;
|
||||
free(pointer);
|
||||
if (head==0) break;
|
||||
}
|
||||
}
|
||||
|
||||
void copy_node(node* from, node* to)
|
||||
{
|
||||
if (to==0) return;
|
||||
to->next=from->next;
|
||||
to->string=from->string;
|
||||
}
|
||||
|
||||
/*/
|
||||
void delete_element(node* tmp1, node* tmp2, node* tmp3)
|
||||
{
|
||||
free(tmp2->string);
|
||||
free(tmp2);
|
||||
tmp1->next=tmp3;
|
||||
}
|
||||
/*/
|
||||
|
||||
int node_len(node* head)
|
||||
{
|
||||
node tmp;
|
||||
int res=1;
|
||||
copy_node(head, &tmp);
|
||||
while(tmp.next!=0)
|
||||
{
|
||||
res++;
|
||||
copy_node(tmp.next, &tmp);
|
||||
//printf("s: %s\n", tmp.string);
|
||||
}
|
||||
return res;
|
||||
}
|
20
2025.05.23/dist/Kochubei_DS/add.h
vendored
Normal file
20
2025.05.23/dist/Kochubei_DS/add.h
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
#define LEN 1235
|
||||
|
||||
struct _node;
|
||||
typedef struct _node
|
||||
{
|
||||
char *string;
|
||||
struct _node* next;
|
||||
} node;
|
||||
|
||||
int read_node(node **, const char *);
|
||||
|
||||
void print_node(int p, node* head);
|
||||
|
||||
void delete_node(node* head);
|
||||
|
||||
void copy_node(node* from, node* to);
|
||||
|
||||
//void delete_element(node* tmp1, node* tmp2, node* tmp3);
|
||||
|
||||
int node_len(node* head);
|
14
2025.05.23/dist/Kochubei_DS/error.txt
vendored
Normal file
14
2025.05.23/dist/Kochubei_DS/error.txt
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
Задача: 1 | Файл: test6.txt | Ошибка: SEGFAULT (нарушение сегментации)
|
||||
Задача: 2 | Файл: test6.txt | Ошибка: SEGFAULT (нарушение сегментации)
|
||||
Задача: 3 | Файл: test6.txt | Ошибка: SEGFAULT (нарушение сегментации)
|
||||
Задача: 4 | Файл: test6.txt | Ошибка: SEGFAULT (нарушение сегментации)
|
||||
Задача: 5 | Файл: test6.txt | Ошибка: SEGFAULT (нарушение сегментации)
|
||||
Задача: 6 | Файл: test6.txt | Ошибка: SEGFAULT (нарушение сегментации)
|
||||
Задача: 7 | Файл: test6.txt | Ошибка: SEGFAULT (нарушение сегментации)
|
||||
Задача: 8 | Файл: test6.txt | Ошибка: SEGFAULT (нарушение сегментации)
|
||||
Задача: 9 | Файл: test6.txt | Ошибка: SEGFAULT (нарушение сегментации)
|
||||
Задача: 10 | Файл: test2.txt | Ошибка: SEGFAULT (нарушение сегментации)
|
||||
Задача: 10 | Файл: test4.txt | Ошибка: SEGFAULT (нарушение сегментации)
|
||||
Задача: 10 | Файл: test5.txt | Ошибка: SEGFAULT (нарушение сегментации)
|
||||
Задача: 10 | Файл: test6.txt | Ошибка: SEGFAULT (нарушение сегментации)
|
||||
Задача: 10 | Файл: test8.txt | Ошибка: SEGFAULT (нарушение сегментации)
|
|
@ -8,12 +8,13 @@
|
|||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.01
|
||||
WORK TIME - 00:00:00.00
|
||||
apple
|
||||
banana
|
||||
apple
|
||||
cherry
|
||||
date
|
||||
|
||||
./a01.out : Task = 1 Result = 1 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test2.txt
|
||||
|
@ -23,12 +24,13 @@ date
|
|||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
WORK TIME - 00:00:00.01
|
||||
one
|
||||
one
|
||||
two
|
||||
two
|
||||
two
|
||||
|
||||
./a01.out : Task = 1 Result = 3 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test3.txt
|
||||
|
@ -44,6 +46,7 @@ b
|
|||
c
|
||||
d
|
||||
e
|
||||
|
||||
./a01.out : Task = 1 Result = 1 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test4.txt
|
||||
|
@ -53,12 +56,13 @@ e
|
|||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
WORK TIME - 00:00:00.01
|
||||
h
|
||||
g
|
||||
f
|
||||
e
|
||||
d
|
||||
|
||||
./a01.out : Task = 1 Result = 1 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test5.txt
|
||||
|
@ -74,12 +78,13 @@ dog
|
|||
cat
|
||||
bird
|
||||
fish
|
||||
|
||||
./a01.out : Task = 1 Result = 1 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test6.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a01.out 5 test6.txt
|
||||
ОШИБКА: Программа завершилась с кодом 254
|
||||
ОШИБКА: SEGFAULT (нарушение сегментации)
|
||||
|
||||
Тестируемый файл: test7.txt
|
||||
Максимум выводимых элементов: 5
|
||||
|
@ -88,8 +93,9 @@ fish
|
|||
------------------------------------------------------------
|
||||
total allocation requests: 2 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.01
|
||||
WORK TIME - 00:00:00.00
|
||||
single
|
||||
|
||||
./a01.out : Task = 1 Result = 1 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test8.txt
|
||||
|
@ -103,6 +109,7 @@ WORK TIME - 00:00:00.00
|
|||
very_long_string_1234567890
|
||||
short
|
||||
medium_length_string_123
|
||||
|
||||
./a01.out : Task = 1 Result = 1 Elapsed = 0.00
|
||||
|
||||
|
||||
|
@ -122,6 +129,7 @@ banana
|
|||
apple
|
||||
cherry
|
||||
date
|
||||
|
||||
./a02.out : Task = 2 Result = 5 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test2.txt
|
||||
|
@ -137,6 +145,7 @@ one
|
|||
two
|
||||
two
|
||||
two
|
||||
|
||||
./a02.out : Task = 2 Result = 1 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test3.txt
|
||||
|
@ -146,12 +155,13 @@ two
|
|||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
WORK TIME - 00:00:00.01
|
||||
a
|
||||
b
|
||||
c
|
||||
d
|
||||
e
|
||||
|
||||
./a02.out : Task = 2 Result = 7 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test4.txt
|
||||
|
@ -167,6 +177,7 @@ g
|
|||
f
|
||||
e
|
||||
d
|
||||
|
||||
./a02.out : Task = 2 Result = 0 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test5.txt
|
||||
|
@ -176,18 +187,19 @@ d
|
|||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.01
|
||||
WORK TIME - 00:00:00.00
|
||||
cat
|
||||
dog
|
||||
cat
|
||||
bird
|
||||
fish
|
||||
|
||||
./a02.out : Task = 2 Result = 3 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test6.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a02.out 5 test6.txt
|
||||
ОШИБКА: Программа завершилась с кодом 254
|
||||
ОШИБКА: SEGFAULT (нарушение сегментации)
|
||||
|
||||
Тестируемый файл: test7.txt
|
||||
Максимум выводимых элементов: 5
|
||||
|
@ -198,6 +210,7 @@ total allocation requests: 2 ; max. mem used 0 kBytes
|
|||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
single
|
||||
|
||||
./a02.out : Task = 2 Result = 0 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test8.txt
|
||||
|
@ -207,10 +220,11 @@ single
|
|||
------------------------------------------------------------
|
||||
total allocation requests: 6 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.01
|
||||
WORK TIME - 00:00:00.00
|
||||
very_long_string_1234567890
|
||||
short
|
||||
medium_length_string_123
|
||||
|
||||
./a02.out : Task = 2 Result = 0 Elapsed = 0.00
|
||||
|
||||
|
||||
|
@ -230,7 +244,8 @@ banana
|
|||
apple
|
||||
cherry
|
||||
date
|
||||
./a03.out : Task = 3 Result = 2 Elapsed = 0.00
|
||||
|
||||
./a03.out : Task = 3 Result = 3 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test2.txt
|
||||
Максимум выводимых элементов: 5
|
||||
|
@ -245,7 +260,8 @@ one
|
|||
two
|
||||
two
|
||||
two
|
||||
./a03.out : Task = 3 Result = 3 Elapsed = 0.00
|
||||
|
||||
./a03.out : Task = 3 Result = 4 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test3.txt
|
||||
Максимум выводимых элементов: 5
|
||||
|
@ -260,7 +276,8 @@ b
|
|||
c
|
||||
d
|
||||
e
|
||||
./a03.out : Task = 3 Result = 0 Elapsed = 0.00
|
||||
|
||||
./a03.out : Task = 3 Result = 1 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test4.txt
|
||||
Максимум выводимых элементов: 5
|
||||
|
@ -269,13 +286,14 @@ e
|
|||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
WORK TIME - 00:00:00.01
|
||||
h
|
||||
g
|
||||
f
|
||||
e
|
||||
d
|
||||
./a03.out : Task = 3 Result = 0 Elapsed = 0.00
|
||||
|
||||
./a03.out : Task = 3 Result = 1 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test5.txt
|
||||
Максимум выводимых элементов: 5
|
||||
|
@ -290,12 +308,13 @@ dog
|
|||
cat
|
||||
bird
|
||||
fish
|
||||
./a03.out : Task = 3 Result = 3 Elapsed = 0.00
|
||||
|
||||
./a03.out : Task = 3 Result = 4 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test6.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a03.out 5 test6.txt
|
||||
ОШИБКА: Программа завершилась с кодом 254
|
||||
ОШИБКА: SEGFAULT (нарушение сегментации)
|
||||
|
||||
Тестируемый файл: test7.txt
|
||||
Максимум выводимых элементов: 5
|
||||
|
@ -306,6 +325,7 @@ total allocation requests: 2 ; max. mem used 0 kBytes
|
|||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
single
|
||||
|
||||
./a03.out : Task = 3 Result = 0 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test8.txt
|
||||
|
@ -319,7 +339,8 @@ WORK TIME - 00:00:00.00
|
|||
very_long_string_1234567890
|
||||
short
|
||||
medium_length_string_123
|
||||
./a03.out : Task = 3 Result = 0 Elapsed = 0.00
|
||||
|
||||
./a03.out : Task = 3 Result = 1 Elapsed = 0.00
|
||||
|
||||
|
||||
=================
|
||||
|
@ -338,6 +359,7 @@ banana
|
|||
apple
|
||||
cherry
|
||||
date
|
||||
|
||||
./a04.out : Task = 4 Result = 2 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test2.txt
|
||||
|
@ -353,7 +375,8 @@ one
|
|||
two
|
||||
two
|
||||
two
|
||||
./a04.out : Task = 4 Result = 0 Elapsed = 0.00
|
||||
|
||||
./a04.out : Task = 4 Result = 1 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test3.txt
|
||||
Максимум выводимых элементов: 5
|
||||
|
@ -368,6 +391,7 @@ b
|
|||
c
|
||||
d
|
||||
e
|
||||
|
||||
./a04.out : Task = 4 Result = 0 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test4.txt
|
||||
|
@ -383,6 +407,7 @@ g
|
|||
f
|
||||
e
|
||||
d
|
||||
|
||||
./a04.out : Task = 4 Result = 0 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test5.txt
|
||||
|
@ -392,18 +417,19 @@ d
|
|||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.01
|
||||
WORK TIME - 00:00:00.00
|
||||
cat
|
||||
dog
|
||||
cat
|
||||
bird
|
||||
fish
|
||||
|
||||
./a04.out : Task = 4 Result = 2 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test6.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a04.out 5 test6.txt
|
||||
ОШИБКА: Программа завершилась с кодом 254
|
||||
ОШИБКА: SEGFAULT (нарушение сегментации)
|
||||
|
||||
Тестируемый файл: test7.txt
|
||||
Максимум выводимых элементов: 5
|
||||
|
@ -414,6 +440,7 @@ total allocation requests: 2 ; max. mem used 0 kBytes
|
|||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
single
|
||||
|
||||
./a04.out : Task = 4 Result = 0 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test8.txt
|
||||
|
@ -427,6 +454,7 @@ WORK TIME - 00:00:00.00
|
|||
very_long_string_1234567890
|
||||
short
|
||||
medium_length_string_123
|
||||
|
||||
./a04.out : Task = 4 Result = 0 Elapsed = 0.00
|
||||
|
||||
|
||||
|
@ -446,6 +474,7 @@ banana
|
|||
apple
|
||||
cherry
|
||||
date
|
||||
|
||||
./a05.out : Task = 5 Result = 3 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test2.txt
|
||||
|
@ -461,6 +490,7 @@ one
|
|||
two
|
||||
two
|
||||
two
|
||||
|
||||
./a05.out : Task = 5 Result = 2 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test3.txt
|
||||
|
@ -476,7 +506,8 @@ b
|
|||
c
|
||||
d
|
||||
e
|
||||
./a05.out : Task = 5 Result = 1 Elapsed = 0.00
|
||||
|
||||
./a05.out : Task = 5 Result = 8 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test4.txt
|
||||
Максимум выводимых элементов: 5
|
||||
|
@ -491,6 +522,7 @@ g
|
|||
f
|
||||
e
|
||||
d
|
||||
|
||||
./a05.out : Task = 5 Result = 1 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test5.txt
|
||||
|
@ -500,18 +532,19 @@ d
|
|||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
WORK TIME - 00:00:00.01
|
||||
cat
|
||||
dog
|
||||
cat
|
||||
bird
|
||||
fish
|
||||
|
||||
./a05.out : Task = 5 Result = 2 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test6.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a05.out 5 test6.txt
|
||||
ОШИБКА: Программа завершилась с кодом 254
|
||||
ОШИБКА: SEGFAULT (нарушение сегментации)
|
||||
|
||||
Тестируемый файл: test7.txt
|
||||
Максимум выводимых элементов: 5
|
||||
|
@ -522,6 +555,7 @@ total allocation requests: 2 ; max. mem used 0 kBytes
|
|||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
single
|
||||
|
||||
./a05.out : Task = 5 Result = 1 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test8.txt
|
||||
|
@ -535,6 +569,7 @@ WORK TIME - 00:00:00.00
|
|||
very_long_string_1234567890
|
||||
short
|
||||
medium_length_string_123
|
||||
|
||||
./a05.out : Task = 5 Result = 1 Elapsed = 0.00
|
||||
|
||||
|
||||
|
@ -554,6 +589,7 @@ banana
|
|||
apple
|
||||
cherry
|
||||
date
|
||||
|
||||
./a06.out : Task = 6 Result = 0 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test2.txt
|
||||
|
@ -563,12 +599,13 @@ date
|
|||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.01
|
||||
WORK TIME - 00:00:00.00
|
||||
one
|
||||
one
|
||||
two
|
||||
two
|
||||
two
|
||||
|
||||
./a06.out : Task = 6 Result = 3 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test3.txt
|
||||
|
@ -584,6 +621,7 @@ b
|
|||
c
|
||||
d
|
||||
e
|
||||
|
||||
./a06.out : Task = 6 Result = 0 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test4.txt
|
||||
|
@ -599,6 +637,7 @@ g
|
|||
f
|
||||
e
|
||||
d
|
||||
|
||||
./a06.out : Task = 6 Result = 0 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test5.txt
|
||||
|
@ -614,12 +653,13 @@ dog
|
|||
cat
|
||||
bird
|
||||
fish
|
||||
|
||||
./a06.out : Task = 6 Result = 0 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test6.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a06.out 5 test6.txt
|
||||
ОШИБКА: Программа завершилась с кодом 254
|
||||
ОШИБКА: SEGFAULT (нарушение сегментации)
|
||||
|
||||
Тестируемый файл: test7.txt
|
||||
Максимум выводимых элементов: 5
|
||||
|
@ -628,9 +668,10 @@ fish
|
|||
------------------------------------------------------------
|
||||
total allocation requests: 2 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
WORK TIME - 00:00:00.01
|
||||
single
|
||||
./a06.out : Task = 6 Result = 0 Elapsed = 0.00
|
||||
|
||||
./a06.out : Task = 6 Result = 1 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test8.txt
|
||||
Максимум выводимых элементов: 5
|
||||
|
@ -643,6 +684,7 @@ WORK TIME - 00:00:00.00
|
|||
very_long_string_1234567890
|
||||
short
|
||||
medium_length_string_123
|
||||
|
||||
./a06.out : Task = 6 Result = 0 Elapsed = 0.00
|
||||
|
||||
|
||||
|
@ -656,12 +698,13 @@ medium_length_string_123
|
|||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.01
|
||||
WORK TIME - 00:00:00.00
|
||||
apple
|
||||
banana
|
||||
apple
|
||||
cherry
|
||||
date
|
||||
|
||||
./a07.out : Task = 7 Result = 0 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test2.txt
|
||||
|
@ -677,6 +720,7 @@ one
|
|||
two
|
||||
two
|
||||
two
|
||||
|
||||
./a07.out : Task = 7 Result = 1 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test3.txt
|
||||
|
@ -692,6 +736,7 @@ b
|
|||
c
|
||||
d
|
||||
e
|
||||
|
||||
./a07.out : Task = 7 Result = 0 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test4.txt
|
||||
|
@ -701,12 +746,13 @@ e
|
|||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.01
|
||||
WORK TIME - 00:00:00.00
|
||||
h
|
||||
g
|
||||
f
|
||||
e
|
||||
d
|
||||
|
||||
./a07.out : Task = 7 Result = 0 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test5.txt
|
||||
|
@ -722,12 +768,13 @@ dog
|
|||
cat
|
||||
bird
|
||||
fish
|
||||
|
||||
./a07.out : Task = 7 Result = 0 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test6.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a07.out 5 test6.txt
|
||||
ОШИБКА: Программа завершилась с кодом 254
|
||||
ОШИБКА: SEGFAULT (нарушение сегментации)
|
||||
|
||||
Тестируемый файл: test7.txt
|
||||
Максимум выводимых элементов: 5
|
||||
|
@ -738,7 +785,8 @@ total allocation requests: 2 ; max. mem used 0 kBytes
|
|||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
single
|
||||
./a07.out : Task = 7 Result = 0 Elapsed = 0.00
|
||||
|
||||
./a07.out : Task = 7 Result = 1 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test8.txt
|
||||
Максимум выводимых элементов: 5
|
||||
|
@ -751,6 +799,7 @@ WORK TIME - 00:00:00.00
|
|||
very_long_string_1234567890
|
||||
short
|
||||
medium_length_string_123
|
||||
|
||||
./a07.out : Task = 7 Result = 0 Elapsed = 0.00
|
||||
|
||||
|
||||
|
@ -765,19 +814,18 @@ medium_length_string_123
|
|||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
apple
|
||||
banana
|
||||
apple
|
||||
cherry
|
||||
date
|
||||
|
||||
Final list:
|
||||
apple
|
||||
apple
|
||||
cherry
|
||||
apple
|
||||
fig
|
||||
|
||||
./a08.out : Task = 8 Length = 6 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test2.txt
|
||||
|
@ -788,17 +836,18 @@ fig
|
|||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
one
|
||||
one
|
||||
two
|
||||
two
|
||||
two
|
||||
|
||||
Final list:
|
||||
one
|
||||
two
|
||||
three
|
||||
four
|
||||
./a08.out : Task = 8 Length = 2 Elapsed = 0.00
|
||||
|
||||
./a08.out : Task = 8 Length = 4 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test3.txt
|
||||
Максимум выводимых элементов: 5
|
||||
|
@ -808,19 +857,18 @@ four
|
|||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
a
|
||||
b
|
||||
c
|
||||
d
|
||||
e
|
||||
|
||||
Final list:
|
||||
a
|
||||
b
|
||||
c
|
||||
d
|
||||
e
|
||||
|
||||
./a08.out : Task = 8 Length = 8 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test4.txt
|
||||
|
@ -831,15 +879,14 @@ e
|
|||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
h
|
||||
g
|
||||
f
|
||||
e
|
||||
d
|
||||
|
||||
Final list:
|
||||
a
|
||||
|
||||
./a08.out : Task = 8 Length = 1 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test5.txt
|
||||
|
@ -850,24 +897,24 @@ a
|
|||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
cat
|
||||
dog
|
||||
cat
|
||||
bird
|
||||
fish
|
||||
|
||||
Final list:
|
||||
cat
|
||||
cat
|
||||
bird
|
||||
bird
|
||||
cat
|
||||
./a08.out : Task = 8 Length = 4 Elapsed = 0.00
|
||||
|
||||
./a08.out : Task = 8 Length = 5 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test6.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a08.out 5 test6.txt
|
||||
ОШИБКА: Программа завершилась с кодом 254
|
||||
ОШИБКА: SEGFAULT (нарушение сегментации)
|
||||
|
||||
Тестируемый файл: test7.txt
|
||||
Максимум выводимых элементов: 5
|
||||
|
@ -877,11 +924,10 @@ cat
|
|||
total allocation requests: 2 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
single
|
||||
|
||||
Final list:
|
||||
single
|
||||
|
||||
./a08.out : Task = 8 Length = 1 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test8.txt
|
||||
|
@ -892,13 +938,12 @@ single
|
|||
total allocation requests: 6 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
very_long_string_1234567890
|
||||
short
|
||||
medium_length_string_123
|
||||
|
||||
Final list:
|
||||
medium_length_string_123
|
||||
|
||||
./a08.out : Task = 8 Length = 1 Elapsed = 0.00
|
||||
|
||||
|
||||
|
@ -913,19 +958,18 @@ medium_length_string_123
|
|||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
apple
|
||||
banana
|
||||
apple
|
||||
cherry
|
||||
date
|
||||
|
||||
Final list:
|
||||
apple
|
||||
apple
|
||||
cherry
|
||||
apple
|
||||
fig
|
||||
|
||||
./a09.out : Task = 9 Length = 6 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test2.txt
|
||||
|
@ -936,20 +980,19 @@ fig
|
|||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
one
|
||||
one
|
||||
two
|
||||
two
|
||||
two
|
||||
|
||||
Final list:
|
||||
one
|
||||
one
|
||||
two
|
||||
three
|
||||
four
|
||||
four
|
||||
./a09.out : Task = 9 Length = 5 Elapsed = 0.00
|
||||
|
||||
./a09.out : Task = 9 Length = 6 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test3.txt
|
||||
Максимум выводимых элементов: 5
|
||||
|
@ -958,20 +1001,19 @@ four
|
|||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
WORK TIME - 00:00:00.01
|
||||
a
|
||||
b
|
||||
c
|
||||
d
|
||||
e
|
||||
|
||||
Final list:
|
||||
a
|
||||
b
|
||||
c
|
||||
d
|
||||
e
|
||||
|
||||
./a09.out : Task = 9 Length = 8 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test4.txt
|
||||
|
@ -982,19 +1024,18 @@ e
|
|||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
h
|
||||
g
|
||||
f
|
||||
e
|
||||
d
|
||||
|
||||
Final list:
|
||||
h
|
||||
g
|
||||
f
|
||||
e
|
||||
d
|
||||
|
||||
./a09.out : Task = 9 Length = 8 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test5.txt
|
||||
|
@ -1004,26 +1045,25 @@ d
|
|||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
WORK TIME - 00:00:00.01
|
||||
cat
|
||||
dog
|
||||
cat
|
||||
bird
|
||||
fish
|
||||
|
||||
Final list:
|
||||
cat
|
||||
cat
|
||||
bird
|
||||
bird
|
||||
cat
|
||||
./a09.out : Task = 9 Length = 5 Elapsed = 0.00
|
||||
dog
|
||||
|
||||
./a09.out : Task = 9 Length = 6 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test6.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a09.out 5 test6.txt
|
||||
ОШИБКА: Программа завершилась с кодом 254
|
||||
ОШИБКА: SEGFAULT (нарушение сегментации)
|
||||
|
||||
Тестируемый файл: test7.txt
|
||||
Максимум выводимых элементов: 5
|
||||
|
@ -1033,11 +1073,10 @@ cat
|
|||
total allocation requests: 2 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
single
|
||||
|
||||
Final list:
|
||||
single
|
||||
|
||||
./a09.out : Task = 9 Length = 1 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test8.txt
|
||||
|
@ -1048,15 +1087,14 @@ single
|
|||
total allocation requests: 6 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
very_long_string_1234567890
|
||||
short
|
||||
medium_length_string_123
|
||||
|
||||
Final list:
|
||||
very_long_string_1234567890
|
||||
short
|
||||
medium_length_string_123
|
||||
|
||||
./a09.out : Task = 9 Length = 3 Elapsed = 0.00
|
||||
|
||||
|
||||
|
@ -1069,39 +1107,42 @@ medium_length_string_123
|
|||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
leak 44 Bytes in 4 blocks
|
||||
Run 'LeakAnalyze ./a10.out' to find problems
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
apple
|
||||
banana
|
||||
apple
|
||||
cherry
|
||||
date
|
||||
|
||||
Final list:
|
||||
apple
|
||||
banana
|
||||
apple
|
||||
cherry
|
||||
date
|
||||
apple
|
||||
fig
|
||||
grape
|
||||
|
||||
apple
|
||||
cherry
|
||||
date
|
||||
apple
|
||||
fig
|
||||
grape
|
||||
|
||||
apple
|
||||
cherry
|
||||
fig
|
||||
grape
|
||||
|
||||
./a10.out : Task = 10 Length = 4 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test2.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a10.out 5 test2.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
one
|
||||
one
|
||||
two
|
||||
two
|
||||
two
|
||||
|
||||
Final list:
|
||||
./a10.out : Task = 10 Length = 0 Elapsed = 0.00
|
||||
ОШИБКА: SEGFAULT (нарушение сегментации)
|
||||
|
||||
Тестируемый файл: test3.txt
|
||||
Максимум выводимых элементов: 5
|
||||
|
@ -1110,63 +1151,35 @@ Final list:
|
|||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
WORK TIME - 00:00:00.01
|
||||
a
|
||||
b
|
||||
c
|
||||
d
|
||||
e
|
||||
|
||||
Final list:
|
||||
a
|
||||
b
|
||||
c
|
||||
d
|
||||
e
|
||||
|
||||
./a10.out : Task = 10 Length = 8 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test4.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a10.out 5 test4.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
h
|
||||
g
|
||||
f
|
||||
e
|
||||
d
|
||||
|
||||
Final list:
|
||||
./a10.out : Task = 10 Length = 0 Elapsed = 0.00
|
||||
ОШИБКА: SEGFAULT (нарушение сегментации)
|
||||
|
||||
Тестируемый файл: test5.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a10.out 5 test5.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
cat
|
||||
dog
|
||||
cat
|
||||
bird
|
||||
fish
|
||||
|
||||
Final list:
|
||||
cat
|
||||
./a10.out : Task = 10 Length = 1 Elapsed = 0.00
|
||||
ОШИБКА: SEGFAULT (нарушение сегментации)
|
||||
|
||||
Тестируемый файл: test6.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a10.out 5 test6.txt
|
||||
ОШИБКА: Программа завершилась с кодом 254
|
||||
ОШИБКА: SEGFAULT (нарушение сегментации)
|
||||
|
||||
Тестируемый файл: test7.txt
|
||||
Максимум выводимых элементов: 5
|
||||
|
@ -1175,29 +1188,17 @@ cat
|
|||
------------------------------------------------------------
|
||||
total allocation requests: 2 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.01
|
||||
Source list:
|
||||
WORK TIME - 00:00:00.00
|
||||
single
|
||||
|
||||
Final list:
|
||||
single
|
||||
|
||||
./a10.out : Task = 10 Length = 1 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test8.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a10.out 5 test8.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 6 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
very_long_string_1234567890
|
||||
short
|
||||
medium_length_string_123
|
||||
|
||||
Final list:
|
||||
./a10.out : Task = 10 Length = 0 Elapsed = 0.00
|
||||
ОШИБКА: SEGFAULT (нарушение сегментации)
|
||||
|
||||
|
||||
Найдено ошибок: 10
|
||||
Найдено ошибок: 14
|
636
2025.05.23/dist/Kochubei_DS/solve.c
vendored
Normal file
636
2025.05.23/dist/Kochubei_DS/solve.c
vendored
Normal file
|
@ -0,0 +1,636 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include "solve.h"
|
||||
|
||||
int solve1(node* head)
|
||||
{
|
||||
char s[1]={'\0'};
|
||||
int cnt=0;
|
||||
char* mx=s;
|
||||
node tmp;
|
||||
|
||||
copy_node(head, &tmp);
|
||||
while(1)
|
||||
{
|
||||
int r=0;
|
||||
|
||||
r=strcmp(tmp.string, mx);
|
||||
if (r>0)
|
||||
{
|
||||
mx=tmp.string;
|
||||
cnt=1;
|
||||
}
|
||||
if (r==0)
|
||||
{
|
||||
cnt++;
|
||||
}
|
||||
if (tmp.next==0) break;
|
||||
copy_node(tmp.next, &tmp);
|
||||
}
|
||||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
int solve2(node* head)
|
||||
{
|
||||
int cnt=0;
|
||||
node tmp1;
|
||||
node tmp2;
|
||||
copy_node(head, &tmp1);
|
||||
|
||||
if (head->next==0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
copy_node(head->next, &tmp2);
|
||||
//printf("OK\n");
|
||||
while(1)
|
||||
{
|
||||
if (strcmp(tmp1.string, tmp2.string)<0)
|
||||
{
|
||||
//printf("%s\n", tmp2.string);
|
||||
cnt++;
|
||||
}
|
||||
if (tmp2.next==0) break;
|
||||
copy_node(&tmp2, &tmp1);
|
||||
copy_node(tmp2.next, &tmp2);
|
||||
}
|
||||
return cnt;
|
||||
}
|
||||
|
||||
int solve3(node* head)
|
||||
{
|
||||
char s[1]={'\0'};
|
||||
int cnt=0;
|
||||
node tmp1;
|
||||
node tmp2;
|
||||
node tmp3;
|
||||
if (head->next==0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
tmp1.next=0;
|
||||
tmp1.string=s;
|
||||
copy_node(head, &tmp2);
|
||||
copy_node(head->next, &tmp3);
|
||||
while(1)
|
||||
{
|
||||
if (strcmp(tmp1.string, tmp2.string)<=0 && strcmp(tmp2.string, tmp3.string)>=0)
|
||||
{
|
||||
cnt++;
|
||||
}
|
||||
if (tmp3.next==0) break;
|
||||
copy_node(&tmp2, &tmp1);
|
||||
copy_node(&tmp3, &tmp2);
|
||||
copy_node(tmp3.next, &tmp3);
|
||||
}
|
||||
if (strcmp(tmp1.string, tmp2.string)<=0)
|
||||
{
|
||||
cnt++;
|
||||
}
|
||||
return cnt;
|
||||
}
|
||||
|
||||
int solve4(node* head)
|
||||
{
|
||||
char s[1]={'\0'};
|
||||
int index=0;
|
||||
int last_index=INT_MAX;
|
||||
int mx=0;
|
||||
node tmp1;
|
||||
node tmp2;
|
||||
node tmp3;
|
||||
if (head->next==0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
tmp1.next=0;
|
||||
tmp1.string=s;
|
||||
copy_node(head, &tmp2);
|
||||
copy_node(head->next, &tmp3);
|
||||
while(1)
|
||||
{
|
||||
if (strcmp(tmp1.string, tmp2.string)<=0 && strcmp(tmp2.string, tmp3.string)>=0)
|
||||
{
|
||||
int d=index-last_index-1;
|
||||
if (d>mx)
|
||||
{
|
||||
mx=d;
|
||||
}
|
||||
last_index=index;
|
||||
|
||||
}
|
||||
if (tmp3.next==0) break;
|
||||
copy_node(&tmp2, &tmp1);
|
||||
copy_node(&tmp3, &tmp2);
|
||||
copy_node(tmp3.next, &tmp3);
|
||||
index++;
|
||||
}
|
||||
if (strcmp(tmp1.string, tmp2.string)<=0)
|
||||
{
|
||||
int d=index-last_index-1;
|
||||
if (d>mx)
|
||||
{
|
||||
mx=d;
|
||||
}
|
||||
last_index=index;
|
||||
}
|
||||
return mx;
|
||||
}
|
||||
|
||||
int solve5(node* head)
|
||||
{
|
||||
int mx=0;
|
||||
int len=1;
|
||||
node tmp1;
|
||||
node tmp2;
|
||||
if (head->next==0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
copy_node(head, &tmp1);
|
||||
copy_node(head->next, &tmp2);
|
||||
while(1)
|
||||
{
|
||||
if (strcmp(tmp2.string, tmp1.string)>0)
|
||||
{
|
||||
len++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (len>mx)
|
||||
{
|
||||
mx=len;
|
||||
}
|
||||
len=1;
|
||||
}
|
||||
if (tmp2.next==0) break;
|
||||
copy_node(&tmp2, &tmp1);
|
||||
copy_node(tmp2.next, &tmp2);
|
||||
}
|
||||
if (len>mx)
|
||||
{
|
||||
mx=len;
|
||||
}
|
||||
return mx;
|
||||
}
|
||||
|
||||
int solve6(node* head)
|
||||
{
|
||||
int cnt=0;
|
||||
int len=1;
|
||||
node tmp1;
|
||||
node tmp2;
|
||||
if (head->next==0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
copy_node(head, &tmp1);
|
||||
copy_node(head->next, &tmp2);
|
||||
while(1)
|
||||
{
|
||||
if (strcmp(tmp2.string, tmp1.string)==0)
|
||||
{
|
||||
len++;
|
||||
//printf("%s %s\n", tmp1.string, tmp2.string);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (len>=2)
|
||||
{
|
||||
cnt++;
|
||||
}
|
||||
len=1;
|
||||
}
|
||||
if (tmp2.next==0) break;
|
||||
copy_node(&tmp2, &tmp1);
|
||||
copy_node(tmp2.next, &tmp2);
|
||||
}
|
||||
if (len>=2)
|
||||
{
|
||||
cnt++;
|
||||
}
|
||||
return cnt;
|
||||
}
|
||||
|
||||
int solve7(node* head)
|
||||
{
|
||||
int index=0;
|
||||
int last_index=INT_MAX;
|
||||
int mx=0;
|
||||
int len=1;
|
||||
node tmp1;
|
||||
node tmp2;
|
||||
if (head->next==0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
copy_node(head, &tmp1);
|
||||
copy_node(head->next, &tmp2);
|
||||
while(1)
|
||||
{
|
||||
if (strcmp(tmp2.string, tmp1.string)==0)
|
||||
{
|
||||
if (len==1)
|
||||
{
|
||||
int d=index-last_index-1;
|
||||
if (d>mx)
|
||||
{
|
||||
mx=d;
|
||||
}
|
||||
}
|
||||
len++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (len>2)
|
||||
{
|
||||
last_index=index;
|
||||
}
|
||||
len=1;
|
||||
}
|
||||
if (tmp2.next==0) break;
|
||||
copy_node(&tmp2, &tmp1);
|
||||
copy_node(tmp2.next, &tmp2);
|
||||
index++;
|
||||
}
|
||||
return mx;
|
||||
}
|
||||
|
||||
node* solve8(node* head)
|
||||
{
|
||||
|
||||
node tmp1;
|
||||
node tmp2;
|
||||
node tmp3;
|
||||
node* ptr1;
|
||||
node* ptr2;
|
||||
node* ptr3;
|
||||
if (head->next==0)
|
||||
{
|
||||
return head;
|
||||
}
|
||||
if (head->next->next==0)
|
||||
{
|
||||
if (strcmp(head->string, head->next->string)>=0)
|
||||
{
|
||||
node* res=head->next;
|
||||
free(head->string);
|
||||
free(head);
|
||||
return res;
|
||||
}
|
||||
else
|
||||
{
|
||||
return head;
|
||||
}
|
||||
}
|
||||
while(strcmp(head->string, head->next->string)>=0)
|
||||
{
|
||||
node* p=head->next;
|
||||
free(head->string);
|
||||
free(head);
|
||||
head=p;
|
||||
if (head->next==0) return head;
|
||||
}
|
||||
copy_node(head, &tmp1);
|
||||
copy_node(head->next, &tmp2);
|
||||
copy_node(head->next->next, &tmp3);
|
||||
ptr1=head;
|
||||
ptr2=head->next;
|
||||
ptr3=head->next->next;
|
||||
while(1)
|
||||
{
|
||||
if (strcmp(tmp2.string, tmp3.string)>=0)
|
||||
{
|
||||
//copy_node(ptr2, &last_thrown);
|
||||
ptr1->next=ptr3;
|
||||
free(ptr2->string);
|
||||
free(ptr2);
|
||||
ptr1=ptr3;
|
||||
if (ptr3->next==0) break;
|
||||
ptr2=ptr3->next;
|
||||
if (ptr2->next==0) break;
|
||||
else ptr3=ptr2->next;
|
||||
copy_node(ptr1, &tmp1);
|
||||
copy_node(ptr2, &tmp2);
|
||||
copy_node(ptr3, &tmp3);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ptr3->next==0) break;
|
||||
copy_node(&tmp2, &tmp1);
|
||||
copy_node(&tmp3, &tmp2);
|
||||
copy_node(tmp3.next, &tmp3);
|
||||
ptr1=ptr2;
|
||||
ptr2=ptr3;
|
||||
ptr3=ptr3->next;
|
||||
}
|
||||
}
|
||||
return head;
|
||||
|
||||
}
|
||||
|
||||
node* solve9(node* head)
|
||||
{
|
||||
char s[1]={'\0'};
|
||||
int was_thrown=0;
|
||||
node last_thrown;
|
||||
node tmp1;
|
||||
node tmp2;
|
||||
node tmp3;
|
||||
node* ptr1;
|
||||
node* ptr2;
|
||||
node* ptr3;
|
||||
last_thrown.next=0;
|
||||
last_thrown.string=s;
|
||||
if (head->next==0)
|
||||
{
|
||||
return head;
|
||||
}
|
||||
if (head->next->next==0)
|
||||
{
|
||||
return head;
|
||||
}
|
||||
copy_node(head, &tmp1);
|
||||
copy_node(head->next, &tmp2);
|
||||
copy_node(head->next->next, &tmp3);
|
||||
ptr1=head;
|
||||
ptr2=head->next;
|
||||
ptr3=head->next->next;
|
||||
while(ptr3->next!=0)
|
||||
{
|
||||
if (was_thrown==0)
|
||||
{
|
||||
if (strcmp(tmp2.string, tmp1.string)>=0 && strcmp(tmp2.string, tmp3.string)>=0)
|
||||
{
|
||||
copy_node(ptr2, &last_thrown);
|
||||
ptr1->next=ptr3;
|
||||
free(ptr2->string);
|
||||
free(ptr2);
|
||||
ptr1=ptr3;
|
||||
ptr2=ptr3->next;
|
||||
if (ptr2->next==0) break;
|
||||
else ptr3=ptr2->next;
|
||||
copy_node(ptr1, &tmp1);
|
||||
copy_node(ptr2, &tmp2);
|
||||
copy_node(ptr3, &tmp3);
|
||||
was_thrown=1;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
copy_node(&tmp2, &tmp1);
|
||||
copy_node(&tmp3, &tmp2);
|
||||
copy_node(tmp3.next, &tmp3);
|
||||
ptr1=ptr2;
|
||||
ptr2=ptr3;
|
||||
ptr3=ptr3->next;
|
||||
was_thrown=0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strcmp(tmp2.string, last_thrown.string)>=0 && strcmp(tmp2.string, tmp3.string)>=0)
|
||||
{
|
||||
copy_node(ptr2, &last_thrown);
|
||||
ptr1->next=ptr3;
|
||||
free(ptr2->string);
|
||||
free(ptr2);
|
||||
ptr1=ptr3;
|
||||
ptr2=ptr3->next;
|
||||
if (ptr2->next==0) break;
|
||||
else ptr3=ptr2->next;
|
||||
copy_node(ptr1, &tmp1);
|
||||
copy_node(ptr2, &tmp2);
|
||||
copy_node(ptr3, &tmp3);
|
||||
was_thrown=1;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
copy_node(&tmp2, &tmp1);
|
||||
copy_node(&tmp3, &tmp2);
|
||||
copy_node(tmp3.next, &tmp3);
|
||||
ptr1=ptr2;
|
||||
ptr2=ptr3;
|
||||
ptr3=ptr3->next;
|
||||
was_thrown=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return head;
|
||||
}
|
||||
|
||||
|
||||
node* solve10(node* head)
|
||||
{
|
||||
|
||||
char s[1]={'\0'};
|
||||
node base;
|
||||
int len=1;
|
||||
node tmp1;
|
||||
node tmp2;
|
||||
node* ptr0;
|
||||
node* ptr1;
|
||||
node* ptr2;
|
||||
node* start_falling;
|
||||
base.next=head;
|
||||
base.string=s;
|
||||
if (head->next==0)
|
||||
{
|
||||
return head;
|
||||
}
|
||||
copy_node(head, &tmp1);
|
||||
copy_node(head->next, &tmp2);
|
||||
ptr0=&base;
|
||||
ptr1=head;
|
||||
ptr2=head->next;
|
||||
while(1)
|
||||
{
|
||||
if (strcmp(tmp2.string, tmp1.string)<=0)
|
||||
{
|
||||
if (len==1) start_falling=ptr0;
|
||||
len++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (len>1)
|
||||
{
|
||||
node* save=start_falling->next;
|
||||
//printf("Start_falling: %s Start_next: %s Finish %s Ptr0: %s p1: %s p: %s neext: %s\n", start_falling->string, start_falling->next->string, tmp2.string, ptr0->string, ptr1->string, ptr2->string, ptr2->next->string);
|
||||
print_node(100, base.next);
|
||||
start_falling->next=ptr2;
|
||||
//ptr1->next=0;
|
||||
//delete_node(save);
|
||||
while(1)
|
||||
{
|
||||
node* p=save->next;
|
||||
if (p==ptr2) break;
|
||||
free(save->string);
|
||||
free(save);
|
||||
save=p;
|
||||
}
|
||||
}
|
||||
len=1;
|
||||
}
|
||||
if (tmp2.next==0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
copy_node(&tmp2, &tmp1);
|
||||
copy_node(tmp2.next, &tmp2);
|
||||
ptr0=ptr1;
|
||||
ptr1=ptr2;
|
||||
ptr2=ptr2->next;
|
||||
}
|
||||
if (len>1)
|
||||
{
|
||||
node* save=start_falling->next;
|
||||
//printf("Start: %s Finish %s\n", start_falling->next->string, tmp2.string);
|
||||
start_falling->next=0;
|
||||
delete_node(save);
|
||||
}
|
||||
return base.next;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*/
|
||||
node* solve10(node* head)
|
||||
{
|
||||
int flag=0;
|
||||
char s[1]={'\0'};
|
||||
node base;
|
||||
node tmp1;
|
||||
node tmp2;
|
||||
node tmp3;
|
||||
node* ptr1;
|
||||
node* ptr2;
|
||||
node* ptr3;
|
||||
node* save;
|
||||
base.next=head;
|
||||
base.string=s;
|
||||
if (head->next==0)
|
||||
{
|
||||
return head;
|
||||
}
|
||||
copy_node(&base, &tmp1);
|
||||
copy_node(head, &tmp2);
|
||||
copy_node(head->next, &tmp3);
|
||||
ptr1=&base;
|
||||
ptr2=head;
|
||||
ptr3=head->next;
|
||||
while(1)
|
||||
{
|
||||
if (flag==1)
|
||||
{
|
||||
save->next=ptr2;
|
||||
free(ptr1->string);
|
||||
free(ptr1);
|
||||
ptr1=ptr2;
|
||||
ptr2=ptr3;
|
||||
if (ptr3->next==0) break;
|
||||
ptr3=ptr3->next;
|
||||
if (ptr2->next==0) break;
|
||||
copy_node(ptr1, &tmp1);
|
||||
copy_node(ptr2, &tmp2);
|
||||
copy_node(ptr3, &tmp3);
|
||||
flag=0;
|
||||
|
||||
ptr1->next=ptr3;
|
||||
free(ptr2->string);
|
||||
free(ptr2);
|
||||
ptr1=ptr3;
|
||||
if (ptr3->next==0) break;
|
||||
ptr2=ptr3->next;
|
||||
if (ptr2->next==0) break;
|
||||
else ptr3=ptr2->next;
|
||||
copy_node(ptr1, &tmp1);
|
||||
copy_node(ptr2, &tmp2);
|
||||
copy_node(ptr3, &tmp3);
|
||||
flag=0;
|
||||
printf("DELETED 2\n");
|
||||
print_node(100, base.next);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ptr3->next==0) break;
|
||||
copy_node(&tmp2, &tmp1);
|
||||
copy_node(&tmp3, &tmp2);
|
||||
copy_node(tmp3.next, &tmp3);
|
||||
ptr1=ptr2;
|
||||
ptr2=ptr3;
|
||||
ptr3=ptr3->next;
|
||||
}
|
||||
if (strcmp(tmp2.string,tmp3.string)>=0)
|
||||
{
|
||||
save=ptr1;
|
||||
ptr1->next=ptr3;
|
||||
free(ptr2->string);
|
||||
free(ptr2);
|
||||
ptr1=ptr3;
|
||||
if (ptr3->next==0) break;
|
||||
ptr2=ptr3->next;
|
||||
if (ptr2->next==0) break;
|
||||
else ptr3=ptr2->next;
|
||||
copy_node(ptr1, &tmp1);
|
||||
copy_node(ptr2, &tmp2);
|
||||
copy_node(ptr3, &tmp3);
|
||||
flag=1;
|
||||
printf("DELETED 1\n");
|
||||
print_node(100, base.next);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (flag==1)
|
||||
{
|
||||
save->next=ptr2;
|
||||
free(ptr1->string);
|
||||
free(ptr1);
|
||||
ptr1=ptr2;
|
||||
ptr2=ptr3;
|
||||
if (ptr3->next==0) break;
|
||||
ptr3=ptr3->next;
|
||||
if (ptr2->next==0) break;
|
||||
copy_node(ptr1, &tmp1);
|
||||
copy_node(ptr2, &tmp2);
|
||||
copy_node(ptr3, &tmp3);
|
||||
flag=0;
|
||||
|
||||
ptr1->next=ptr3;
|
||||
free(ptr2->string);
|
||||
free(ptr2);
|
||||
ptr1=ptr3;
|
||||
if (ptr3->next==0) break;
|
||||
ptr2=ptr3->next;
|
||||
if (ptr2->next==0) break;
|
||||
else ptr3=ptr2->next;
|
||||
copy_node(ptr1, &tmp1);
|
||||
copy_node(ptr2, &tmp2);
|
||||
copy_node(ptr3, &tmp3);
|
||||
flag=0;
|
||||
printf("DELETED 2\n");
|
||||
print_node(100, base.next);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ptr3->next==0) break;
|
||||
copy_node(&tmp2, &tmp1);
|
||||
copy_node(&tmp3, &tmp2);
|
||||
copy_node(tmp3.next, &tmp3);
|
||||
ptr1=ptr2;
|
||||
ptr2=ptr3;
|
||||
ptr3=ptr3->next;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return base.next;
|
||||
}
|
||||
/*/
|
21
2025.05.23/dist/Kochubei_DS/solve.h
vendored
Normal file
21
2025.05.23/dist/Kochubei_DS/solve.h
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
#include "add.h"
|
||||
|
||||
int solve1(node* head);
|
||||
|
||||
int solve2(node* head);
|
||||
|
||||
int solve3(node* head);
|
||||
|
||||
int solve4(node* head);
|
||||
|
||||
int solve5(node* head);
|
||||
|
||||
int solve6(node* head);
|
||||
|
||||
int solve7(node* head);
|
||||
|
||||
node* solve8(node* head);
|
||||
|
||||
node* solve9(node* head);
|
||||
|
||||
node* solve10(node* head);
|
10
2025.05.23/dist/Krivoruchenko_SK/error.txt
vendored
10
2025.05.23/dist/Krivoruchenko_SK/error.txt
vendored
|
@ -1,10 +0,0 @@
|
|||
Задача: 1 | Файл: test6.txt | Ошибка: Программа завершилась с кодом 254
|
||||
Задача: 2 | Файл: test6.txt | Ошибка: Программа завершилась с кодом 254
|
||||
Задача: 3 | Файл: test6.txt | Ошибка: Программа завершилась с кодом 254
|
||||
Задача: 4 | Файл: test6.txt | Ошибка: Программа завершилась с кодом 254
|
||||
Задача: 5 | Файл: test6.txt | Ошибка: Программа завершилась с кодом 254
|
||||
Задача: 6 | Файл: test6.txt | Ошибка: Программа завершилась с кодом 254
|
||||
Задача: 7 | Файл: test6.txt | Ошибка: Программа завершилась с кодом 254
|
||||
Задача: 8 | Файл: test6.txt | Ошибка: Программа завершилась с кодом 254
|
||||
Задача: 9 | Файл: test6.txt | Ошибка: Программа завершилась с кодом 254
|
||||
Задача: 10 | Файл: test6.txt | Ошибка: Программа завершилась с кодом 254
|
4
2025.05.23/dist/Krivoruchenko_SK/solve_03.c
vendored
4
2025.05.23/dist/Krivoruchenko_SK/solve_03.c
vendored
|
@ -31,7 +31,9 @@ int t3_solve (node *head)
|
|||
local = 0;
|
||||
} else
|
||||
local++;
|
||||
}
|
||||
} else
|
||||
if (cmp_next >= 0)
|
||||
local = 1;
|
||||
} else {
|
||||
count += local;
|
||||
local = 0;
|
||||
|
|
3
2025.05.23/dist/Krivoruchenko_SK/solve_05.c
vendored
3
2025.05.23/dist/Krivoruchenko_SK/solve_05.c
vendored
|
@ -24,6 +24,9 @@ int t5_solve (node *head)
|
|||
|
||||
if (maximum < count)
|
||||
maximum = count;
|
||||
|
||||
if (maximum == 1)
|
||||
maximum = 0;
|
||||
|
||||
return maximum;
|
||||
}
|
||||
|
|
38
2025.05.23/dist/Ulianov_MT/Makefile
vendored
Normal file
38
2025.05.23/dist/Ulianov_MT/Makefile
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
FLAGS = -mfpmath=sse -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -Wmaybe-uninitialized -O3
|
||||
all: a01.out a02.out a03.out a04.out a05.out a06.out a07.out
|
||||
a01.out: a01.o list.o
|
||||
gcc a01.o list.o -o a01.out
|
||||
a02.out: a02.o list.o
|
||||
gcc a02.o list.o -o a02.out
|
||||
a03.out: a03.o list.o
|
||||
gcc a03.o list.o -o a03.out
|
||||
a04.out: a04.o list.o
|
||||
gcc a04.o list.o -o a04.out
|
||||
a05.out: a05.o list.o
|
||||
gcc a05.o list.o -o a05.out
|
||||
a06.out: a06.o list.o
|
||||
gcc a06.o list.o -o a06.out
|
||||
a07.out: a07.o list.o
|
||||
gcc a07.o list.o -o a07.out
|
||||
a08.out: a08.o list.o
|
||||
gcc a08.o list.o -o a08.out
|
||||
list.o:
|
||||
gcc -c $(FLAGS) -o list.o list.c
|
||||
a01.o:
|
||||
gcc -c $(FLAGS) -o a01.o task01.c
|
||||
a02.o:
|
||||
gcc -c $(FLAGS) -o a02.o task02.c
|
||||
a03.o:
|
||||
gcc -c $(FLAGS) -o a03.o task03.c
|
||||
a04.o:
|
||||
gcc -c $(FLAGS) -o a04.o task04.c
|
||||
a05.o:
|
||||
gcc -c $(FLAGS) -o a05.o task05.c
|
||||
a06.o:
|
||||
gcc -c $(FLAGS) -o a06.o task06.c
|
||||
a07.o:
|
||||
gcc -c $(FLAGS) -o a07.o task07.c
|
||||
a08.o:
|
||||
gcc -c $(FLAGS) -o a08.o task08.c
|
||||
clean:
|
||||
rm -f *.o *.out
|
33
2025.05.23/dist/Ulianov_MT/error.txt
vendored
Normal file
33
2025.05.23/dist/Ulianov_MT/error.txt
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
Задача: 1 | Файл: test6.txt | Ошибка: Программа завершилась с кодом 254
|
||||
Задача: 2 | Файл: test6.txt | Ошибка: Программа завершилась с кодом 254
|
||||
Задача: 3 | Файл: test6.txt | Ошибка: Программа завершилась с кодом 254
|
||||
Задача: 3 | Файл: test7.txt | Ошибка: SEGFAULT (нарушение сегментации)
|
||||
Задача: 4 | Файл: test6.txt | Ошибка: Программа завершилась с кодом 254
|
||||
Задача: 4 | Файл: test7.txt | Ошибка: SEGFAULT (нарушение сегментации)
|
||||
Задача: 5 | Файл: test6.txt | Ошибка: Программа завершилась с кодом 254
|
||||
Задача: 6 | Файл: test6.txt | Ошибка: Программа завершилась с кодом 254
|
||||
Задача: 7 | Файл: test6.txt | Ошибка: Программа завершилась с кодом 254
|
||||
Задача: 8 | Файл: test1.txt | Ошибка: Исполняемый файл ./a08.out не найден
|
||||
Задача: 8 | Файл: test2.txt | Ошибка: Исполняемый файл ./a08.out не найден
|
||||
Задача: 8 | Файл: test3.txt | Ошибка: Исполняемый файл ./a08.out не найден
|
||||
Задача: 8 | Файл: test4.txt | Ошибка: Исполняемый файл ./a08.out не найден
|
||||
Задача: 8 | Файл: test5.txt | Ошибка: Исполняемый файл ./a08.out не найден
|
||||
Задача: 8 | Файл: test6.txt | Ошибка: Исполняемый файл ./a08.out не найден
|
||||
Задача: 8 | Файл: test7.txt | Ошибка: Исполняемый файл ./a08.out не найден
|
||||
Задача: 8 | Файл: test8.txt | Ошибка: Исполняемый файл ./a08.out не найден
|
||||
Задача: 9 | Файл: test1.txt | Ошибка: Исполняемый файл ./a09.out не найден
|
||||
Задача: 9 | Файл: test2.txt | Ошибка: Исполняемый файл ./a09.out не найден
|
||||
Задача: 9 | Файл: test3.txt | Ошибка: Исполняемый файл ./a09.out не найден
|
||||
Задача: 9 | Файл: test4.txt | Ошибка: Исполняемый файл ./a09.out не найден
|
||||
Задача: 9 | Файл: test5.txt | Ошибка: Исполняемый файл ./a09.out не найден
|
||||
Задача: 9 | Файл: test6.txt | Ошибка: Исполняемый файл ./a09.out не найден
|
||||
Задача: 9 | Файл: test7.txt | Ошибка: Исполняемый файл ./a09.out не найден
|
||||
Задача: 9 | Файл: test8.txt | Ошибка: Исполняемый файл ./a09.out не найден
|
||||
Задача: 10 | Файл: test1.txt | Ошибка: Исполняемый файл ./a10.out не найден
|
||||
Задача: 10 | Файл: test2.txt | Ошибка: Исполняемый файл ./a10.out не найден
|
||||
Задача: 10 | Файл: test3.txt | Ошибка: Исполняемый файл ./a10.out не найден
|
||||
Задача: 10 | Файл: test4.txt | Ошибка: Исполняемый файл ./a10.out не найден
|
||||
Задача: 10 | Файл: test5.txt | Ошибка: Исполняемый файл ./a10.out не найден
|
||||
Задача: 10 | Файл: test6.txt | Ошибка: Исполняемый файл ./a10.out не найден
|
||||
Задача: 10 | Файл: test7.txt | Ошибка: Исполняемый файл ./a10.out не найден
|
||||
Задача: 10 | Файл: test8.txt | Ошибка: Исполняемый файл ./a10.out не найден
|
7
2025.05.23/dist/Ulianov_MT/io_status.h
vendored
Normal file
7
2025.05.23/dist/Ulianov_MT/io_status.h
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
typedef enum io_status_
|
||||
{
|
||||
SUCCESS,
|
||||
ERROR_OPEN,
|
||||
ERROR_READ,
|
||||
ERROR_MEM,
|
||||
} io_status;
|
115
2025.05.23/dist/Ulianov_MT/list.c
vendored
Normal file
115
2025.05.23/dist/Ulianov_MT/list.c
vendored
Normal file
|
@ -0,0 +1,115 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "io_status.h"
|
||||
#include "list.h"
|
||||
|
||||
io_status read_list(node** head, char* name)
|
||||
{
|
||||
char buf[LEN];
|
||||
FILE *fp;
|
||||
int j;
|
||||
node* curr;
|
||||
node* prev;
|
||||
if (!(fp = fopen(name, "r"))) return ERROR_OPEN;
|
||||
curr = (node*) malloc(sizeof(node));
|
||||
if (!curr)
|
||||
{
|
||||
fclose(fp);
|
||||
return ERROR_MEM;
|
||||
}
|
||||
curr->next = 0;
|
||||
if (!fgets(buf, LEN, fp))
|
||||
{
|
||||
fclose(fp);
|
||||
free(curr);
|
||||
return ERROR_READ;
|
||||
}
|
||||
for (j = 0; buf[j]; j++)
|
||||
{
|
||||
if (buf[j] == '\n')
|
||||
{
|
||||
buf[j] = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
curr->string = (char*) malloc((j + 1) * sizeof(char));
|
||||
if (!curr->string)
|
||||
{
|
||||
fclose(fp);
|
||||
free_list(curr);
|
||||
return ERROR_MEM;
|
||||
}
|
||||
strcpy(curr->string, buf);
|
||||
*head = curr;
|
||||
prev = curr;
|
||||
while (fgets(buf, LEN, fp))
|
||||
{
|
||||
for (j = 0; buf[j]; j++)
|
||||
{
|
||||
if (buf[j] == '\n')
|
||||
{
|
||||
buf[j] = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
curr = (node*) malloc(sizeof(node));
|
||||
if (!curr)
|
||||
{
|
||||
fclose(fp);
|
||||
free_list(*head);
|
||||
return ERROR_MEM;
|
||||
}
|
||||
curr->next = 0;
|
||||
curr->string = (char*) malloc((j + 1) * sizeof(char));
|
||||
if (!curr->string)
|
||||
{
|
||||
free_list(*head);
|
||||
fclose(fp);
|
||||
return ERROR_MEM;
|
||||
}
|
||||
strcpy(curr->string, buf);
|
||||
prev->next = curr;
|
||||
prev = curr;
|
||||
}
|
||||
if (!feof(fp))
|
||||
{
|
||||
fclose(fp);
|
||||
free_list(*head);
|
||||
return ERROR_READ;
|
||||
}
|
||||
fclose(fp);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
void print_list(node* head, int p)
|
||||
{
|
||||
int i = 0;
|
||||
node* curr;
|
||||
for (curr = head; curr; curr = curr->next)
|
||||
{
|
||||
if (i >= p) break;
|
||||
printf("%s\n", curr->string);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
void free_list(node* head)
|
||||
{
|
||||
node* curr;
|
||||
node* next;
|
||||
for (curr = head; curr; curr = next)
|
||||
{
|
||||
next = curr->next;
|
||||
free(curr->string);
|
||||
free(curr);
|
||||
}
|
||||
}
|
||||
|
||||
int get_length(node* head)
|
||||
{
|
||||
node* curr;
|
||||
int len = 0;
|
||||
for (curr = head; curr; curr = curr->next) len++;
|
||||
return len;
|
||||
}
|
13
2025.05.23/dist/Ulianov_MT/list.h
vendored
Normal file
13
2025.05.23/dist/Ulianov_MT/list.h
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
#define LEN 1234
|
||||
|
||||
struct _node;
|
||||
typedef struct _node
|
||||
{
|
||||
char* string;
|
||||
struct _node* next;
|
||||
} node;
|
||||
|
||||
io_status read_list(node**, char*);
|
||||
void print_list(node*, int);
|
||||
void free_list(node*);
|
||||
int get_length(node*);
|
|
@ -59,7 +59,7 @@ g
|
|||
f
|
||||
e
|
||||
d
|
||||
./a01.out : Task = 1 Result = 1 Elapsed = 0.00
|
||||
./a01.out : Task = 1 Result = 2 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test5.txt
|
||||
Максимум выводимых элементов: 5
|
||||
|
@ -88,9 +88,9 @@ fish
|
|||
------------------------------------------------------------
|
||||
total allocation requests: 2 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.01
|
||||
WORK TIME - 00:00:00.00
|
||||
single
|
||||
./a01.out : Task = 1 Result = 1 Elapsed = 0.00
|
||||
./a01.out : Task = 1 Result = 2 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test8.txt
|
||||
Максимум выводимых элементов: 5
|
||||
|
@ -99,11 +99,11 @@ single
|
|||
------------------------------------------------------------
|
||||
total allocation requests: 6 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
WORK TIME - 00:00:00.01
|
||||
very_long_string_1234567890
|
||||
short
|
||||
medium_length_string_123
|
||||
./a01.out : Task = 1 Result = 1 Elapsed = 0.00
|
||||
./a01.out : Task = 1 Result = 2 Elapsed = 0.00
|
||||
|
||||
|
||||
=================
|
||||
|
@ -176,7 +176,7 @@ d
|
|||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.01
|
||||
WORK TIME - 00:00:00.00
|
||||
cat
|
||||
dog
|
||||
cat
|
||||
|
@ -196,7 +196,7 @@ fish
|
|||
------------------------------------------------------------
|
||||
total allocation requests: 2 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
WORK TIME - 00:00:00.01
|
||||
single
|
||||
./a02.out : Task = 2 Result = 0 Elapsed = 0.00
|
||||
|
||||
|
@ -207,7 +207,7 @@ single
|
|||
------------------------------------------------------------
|
||||
total allocation requests: 6 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.01
|
||||
WORK TIME - 00:00:00.00
|
||||
very_long_string_1234567890
|
||||
short
|
||||
medium_length_string_123
|
||||
|
@ -239,7 +239,7 @@ date
|
|||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.01
|
||||
WORK TIME - 00:00:00.00
|
||||
one
|
||||
one
|
||||
two
|
||||
|
@ -269,7 +269,7 @@ e
|
|||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
WORK TIME - 00:00:00.01
|
||||
h
|
||||
g
|
||||
f
|
||||
|
@ -300,13 +300,7 @@ fish
|
|||
Тестируемый файл: test7.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a03.out 5 test7.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 2 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
single
|
||||
./a03.out : Task = 3 Result = 0 Elapsed = 0.00
|
||||
ОШИБКА: SEGFAULT (нарушение сегментации)
|
||||
|
||||
Тестируемый файл: test8.txt
|
||||
Максимум выводимых элементов: 5
|
||||
|
@ -315,7 +309,7 @@ single
|
|||
------------------------------------------------------------
|
||||
total allocation requests: 6 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
WORK TIME - 00:00:00.01
|
||||
very_long_string_1234567890
|
||||
short
|
||||
medium_length_string_123
|
||||
|
@ -377,7 +371,7 @@ e
|
|||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
WORK TIME - 00:00:00.01
|
||||
h
|
||||
g
|
||||
f
|
||||
|
@ -392,7 +386,7 @@ d
|
|||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.01
|
||||
WORK TIME - 00:00:00.00
|
||||
cat
|
||||
dog
|
||||
cat
|
||||
|
@ -408,13 +402,7 @@ fish
|
|||
Тестируемый файл: test7.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a04.out 5 test7.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 2 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
single
|
||||
./a04.out : Task = 4 Result = 0 Elapsed = 0.00
|
||||
ОШИБКА: SEGFAULT (нарушение сегментации)
|
||||
|
||||
Тестируемый файл: test8.txt
|
||||
Максимум выводимых элементов: 5
|
||||
|
@ -476,7 +464,7 @@ b
|
|||
c
|
||||
d
|
||||
e
|
||||
./a05.out : Task = 5 Result = 1 Elapsed = 0.00
|
||||
./a05.out : Task = 5 Result = 8 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test4.txt
|
||||
Максимум выводимых элементов: 5
|
||||
|
@ -491,7 +479,7 @@ g
|
|||
f
|
||||
e
|
||||
d
|
||||
./a05.out : Task = 5 Result = 1 Elapsed = 0.00
|
||||
./a05.out : Task = 5 Result = 0 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test5.txt
|
||||
Максимум выводимых элементов: 5
|
||||
|
@ -522,7 +510,7 @@ total allocation requests: 2 ; max. mem used 0 kBytes
|
|||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
single
|
||||
./a05.out : Task = 5 Result = 1 Elapsed = 0.00
|
||||
./a05.out : Task = 5 Result = 0 Elapsed = 0.00
|
||||
|
||||
Тестируемый файл: test8.txt
|
||||
Максимум выводимых элементов: 5
|
||||
|
@ -535,7 +523,7 @@ WORK TIME - 00:00:00.00
|
|||
very_long_string_1234567890
|
||||
short
|
||||
medium_length_string_123
|
||||
./a05.out : Task = 5 Result = 1 Elapsed = 0.00
|
||||
./a05.out : Task = 5 Result = 0 Elapsed = 0.00
|
||||
|
||||
|
||||
=================
|
||||
|
@ -563,7 +551,7 @@ date
|
|||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.01
|
||||
WORK TIME - 00:00:00.00
|
||||
one
|
||||
one
|
||||
two
|
||||
|
@ -578,7 +566,7 @@ two
|
|||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
WORK TIME - 00:00:00.01
|
||||
a
|
||||
b
|
||||
c
|
||||
|
@ -656,7 +644,7 @@ medium_length_string_123
|
|||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.01
|
||||
WORK TIME - 00:00:00.00
|
||||
apple
|
||||
banana
|
||||
apple
|
||||
|
@ -701,7 +689,7 @@ e
|
|||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.01
|
||||
WORK TIME - 00:00:00.00
|
||||
h
|
||||
g
|
||||
f
|
||||
|
@ -759,147 +747,35 @@ medium_length_string_123
|
|||
=================
|
||||
Тестируемый файл: test1.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a08.out 5 test1.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
apple
|
||||
banana
|
||||
apple
|
||||
cherry
|
||||
date
|
||||
|
||||
Final list:
|
||||
apple
|
||||
apple
|
||||
cherry
|
||||
apple
|
||||
fig
|
||||
./a08.out : Task = 8 Length = 6 Elapsed = 0.00
|
||||
Исполняемый файл ./a08.out не найден!
|
||||
|
||||
Тестируемый файл: test2.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a08.out 5 test2.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
one
|
||||
one
|
||||
two
|
||||
two
|
||||
two
|
||||
|
||||
Final list:
|
||||
one
|
||||
four
|
||||
./a08.out : Task = 8 Length = 2 Elapsed = 0.00
|
||||
Исполняемый файл ./a08.out не найден!
|
||||
|
||||
Тестируемый файл: test3.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a08.out 5 test3.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
a
|
||||
b
|
||||
c
|
||||
d
|
||||
e
|
||||
|
||||
Final list:
|
||||
a
|
||||
b
|
||||
c
|
||||
d
|
||||
e
|
||||
./a08.out : Task = 8 Length = 8 Elapsed = 0.00
|
||||
Исполняемый файл ./a08.out не найден!
|
||||
|
||||
Тестируемый файл: test4.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a08.out 5 test4.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
h
|
||||
g
|
||||
f
|
||||
e
|
||||
d
|
||||
|
||||
Final list:
|
||||
a
|
||||
./a08.out : Task = 8 Length = 1 Elapsed = 0.00
|
||||
Исполняемый файл ./a08.out не найден!
|
||||
|
||||
Тестируемый файл: test5.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a08.out 5 test5.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
cat
|
||||
dog
|
||||
cat
|
||||
bird
|
||||
fish
|
||||
|
||||
Final list:
|
||||
cat
|
||||
bird
|
||||
bird
|
||||
cat
|
||||
./a08.out : Task = 8 Length = 4 Elapsed = 0.00
|
||||
Исполняемый файл ./a08.out не найден!
|
||||
|
||||
Тестируемый файл: test6.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a08.out 5 test6.txt
|
||||
ОШИБКА: Программа завершилась с кодом 254
|
||||
Исполняемый файл ./a08.out не найден!
|
||||
|
||||
Тестируемый файл: test7.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a08.out 5 test7.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 2 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
single
|
||||
|
||||
Final list:
|
||||
single
|
||||
./a08.out : Task = 8 Length = 1 Elapsed = 0.00
|
||||
Исполняемый файл ./a08.out не найден!
|
||||
|
||||
Тестируемый файл: test8.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a08.out 5 test8.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 6 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
very_long_string_1234567890
|
||||
short
|
||||
medium_length_string_123
|
||||
|
||||
Final list:
|
||||
medium_length_string_123
|
||||
./a08.out : Task = 8 Length = 1 Elapsed = 0.00
|
||||
Исполняемый файл ./a08.out не найден!
|
||||
|
||||
|
||||
=================
|
||||
|
@ -907,157 +783,35 @@ medium_length_string_123
|
|||
=================
|
||||
Тестируемый файл: test1.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a09.out 5 test1.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
apple
|
||||
banana
|
||||
apple
|
||||
cherry
|
||||
date
|
||||
|
||||
Final list:
|
||||
apple
|
||||
apple
|
||||
cherry
|
||||
apple
|
||||
fig
|
||||
./a09.out : Task = 9 Length = 6 Elapsed = 0.00
|
||||
Исполняемый файл ./a09.out не найден!
|
||||
|
||||
Тестируемый файл: test2.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a09.out 5 test2.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
one
|
||||
one
|
||||
two
|
||||
two
|
||||
two
|
||||
|
||||
Final list:
|
||||
one
|
||||
one
|
||||
three
|
||||
four
|
||||
four
|
||||
./a09.out : Task = 9 Length = 5 Elapsed = 0.00
|
||||
Исполняемый файл ./a09.out не найден!
|
||||
|
||||
Тестируемый файл: test3.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a09.out 5 test3.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
a
|
||||
b
|
||||
c
|
||||
d
|
||||
e
|
||||
|
||||
Final list:
|
||||
a
|
||||
b
|
||||
c
|
||||
d
|
||||
e
|
||||
./a09.out : Task = 9 Length = 8 Elapsed = 0.00
|
||||
Исполняемый файл ./a09.out не найден!
|
||||
|
||||
Тестируемый файл: test4.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a09.out 5 test4.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
h
|
||||
g
|
||||
f
|
||||
e
|
||||
d
|
||||
|
||||
Final list:
|
||||
h
|
||||
g
|
||||
f
|
||||
e
|
||||
d
|
||||
./a09.out : Task = 9 Length = 8 Elapsed = 0.00
|
||||
Исполняемый файл ./a09.out не найден!
|
||||
|
||||
Тестируемый файл: test5.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a09.out 5 test5.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
cat
|
||||
dog
|
||||
cat
|
||||
bird
|
||||
fish
|
||||
|
||||
Final list:
|
||||
cat
|
||||
cat
|
||||
bird
|
||||
bird
|
||||
cat
|
||||
./a09.out : Task = 9 Length = 5 Elapsed = 0.00
|
||||
Исполняемый файл ./a09.out не найден!
|
||||
|
||||
Тестируемый файл: test6.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a09.out 5 test6.txt
|
||||
ОШИБКА: Программа завершилась с кодом 254
|
||||
Исполняемый файл ./a09.out не найден!
|
||||
|
||||
Тестируемый файл: test7.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a09.out 5 test7.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 2 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
single
|
||||
|
||||
Final list:
|
||||
single
|
||||
./a09.out : Task = 9 Length = 1 Elapsed = 0.00
|
||||
Исполняемый файл ./a09.out не найден!
|
||||
|
||||
Тестируемый файл: test8.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a09.out 5 test8.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 6 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
very_long_string_1234567890
|
||||
short
|
||||
medium_length_string_123
|
||||
|
||||
Final list:
|
||||
very_long_string_1234567890
|
||||
short
|
||||
medium_length_string_123
|
||||
./a09.out : Task = 9 Length = 3 Elapsed = 0.00
|
||||
Исполняемый файл ./a09.out не найден!
|
||||
|
||||
|
||||
=================
|
||||
|
@ -1065,139 +819,35 @@ medium_length_string_123
|
|||
=================
|
||||
Тестируемый файл: test1.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a10.out 5 test1.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
apple
|
||||
banana
|
||||
apple
|
||||
cherry
|
||||
date
|
||||
|
||||
Final list:
|
||||
apple
|
||||
cherry
|
||||
fig
|
||||
grape
|
||||
./a10.out : Task = 10 Length = 4 Elapsed = 0.00
|
||||
Исполняемый файл ./a10.out не найден!
|
||||
|
||||
Тестируемый файл: test2.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a10.out 5 test2.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
one
|
||||
one
|
||||
two
|
||||
two
|
||||
two
|
||||
|
||||
Final list:
|
||||
./a10.out : Task = 10 Length = 0 Elapsed = 0.00
|
||||
Исполняемый файл ./a10.out не найден!
|
||||
|
||||
Тестируемый файл: test3.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a10.out 5 test3.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
a
|
||||
b
|
||||
c
|
||||
d
|
||||
e
|
||||
|
||||
Final list:
|
||||
a
|
||||
b
|
||||
c
|
||||
d
|
||||
e
|
||||
./a10.out : Task = 10 Length = 8 Elapsed = 0.00
|
||||
Исполняемый файл ./a10.out не найден!
|
||||
|
||||
Тестируемый файл: test4.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a10.out 5 test4.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
h
|
||||
g
|
||||
f
|
||||
e
|
||||
d
|
||||
|
||||
Final list:
|
||||
./a10.out : Task = 10 Length = 0 Elapsed = 0.00
|
||||
Исполняемый файл ./a10.out не найден!
|
||||
|
||||
Тестируемый файл: test5.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a10.out 5 test5.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 16 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
cat
|
||||
dog
|
||||
cat
|
||||
bird
|
||||
fish
|
||||
|
||||
Final list:
|
||||
cat
|
||||
./a10.out : Task = 10 Length = 1 Elapsed = 0.00
|
||||
Исполняемый файл ./a10.out не найден!
|
||||
|
||||
Тестируемый файл: test6.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a10.out 5 test6.txt
|
||||
ОШИБКА: Программа завершилась с кодом 254
|
||||
Исполняемый файл ./a10.out не найден!
|
||||
|
||||
Тестируемый файл: test7.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a10.out 5 test7.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 2 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.01
|
||||
Source list:
|
||||
single
|
||||
|
||||
Final list:
|
||||
single
|
||||
./a10.out : Task = 10 Length = 1 Elapsed = 0.00
|
||||
Исполняемый файл ./a10.out не найден!
|
||||
|
||||
Тестируемый файл: test8.txt
|
||||
Максимум выводимых элементов: 5
|
||||
Запуск: ./a10.out 5 test8.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
total allocation requests: 6 ; max. mem used 0 kBytes
|
||||
leak 0 Bytes in 0 blocks
|
||||
WORK TIME - 00:00:00.00
|
||||
Source list:
|
||||
very_long_string_1234567890
|
||||
short
|
||||
medium_length_string_123
|
||||
|
||||
Final list:
|
||||
./a10.out : Task = 10 Length = 0 Elapsed = 0.00
|
||||
Исполняемый файл ./a10.out не найден!
|
||||
|
||||
|
||||
Найдено ошибок: 10
|
||||
Найдено ошибок: 33
|
64
2025.05.23/dist/Ulianov_MT/task01.c
vendored
Normal file
64
2025.05.23/dist/Ulianov_MT/task01.c
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include "io_status.h"
|
||||
#include "list.h"
|
||||
|
||||
int solve1(node*);
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int task = 1;
|
||||
char* name = 0;
|
||||
node* head = 0;
|
||||
io_status ret;
|
||||
int p;
|
||||
int res;
|
||||
double t;
|
||||
if (!(argc == 3 && sscanf(argv[1], "%d", &p) == 1))
|
||||
{
|
||||
printf("Usage: %s p file\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
name = argv[2];
|
||||
ret = read_list(&head, name);
|
||||
if (ret != SUCCESS)
|
||||
{
|
||||
switch (ret)
|
||||
{
|
||||
case ERROR_OPEN:
|
||||
printf("Cannot open file %s\n", name);
|
||||
return -1;
|
||||
case ERROR_READ:
|
||||
printf("Cannot read file %s\n", name);
|
||||
return -2;
|
||||
case ERROR_MEM:
|
||||
printf("Cannot allocate memory\n");
|
||||
return -3;
|
||||
default:
|
||||
printf("Unknown error in file %s\n", name);
|
||||
return -4;
|
||||
}
|
||||
}
|
||||
print_list(head, p);
|
||||
t = clock();
|
||||
res = solve1(head);
|
||||
t = (clock() - t) / CLOCKS_PER_SEC;
|
||||
printf("%s : Task = %d Result = %d Elapsed = %.2f\n", argv[0], task, res, t);
|
||||
free_list(head);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int solve1(node* head)
|
||||
{
|
||||
node* curr;
|
||||
char* max = head->string;
|
||||
int count = 1;
|
||||
for (curr = head; curr; curr = curr->next)
|
||||
{
|
||||
if (strcmp(curr->string, max) > 0) {max = curr->string; count = 1;}
|
||||
else if (!strcmp(curr->string, max)) count += 1;
|
||||
}
|
||||
return count;
|
||||
}
|
61
2025.05.23/dist/Ulianov_MT/task02.c
vendored
Normal file
61
2025.05.23/dist/Ulianov_MT/task02.c
vendored
Normal file
|
@ -0,0 +1,61 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include "io_status.h"
|
||||
#include "list.h"
|
||||
|
||||
int solve2(node*);
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int task = 2;
|
||||
char* name = 0;
|
||||
node* head = 0;
|
||||
io_status ret;
|
||||
int p;
|
||||
int res;
|
||||
double t;
|
||||
if (!(argc == 3 && sscanf(argv[1], "%d", &p) == 1))
|
||||
{
|
||||
printf("Usage: %s p file\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
name = argv[2];
|
||||
ret = read_list(&head, name);
|
||||
if (ret != SUCCESS)
|
||||
{
|
||||
switch (ret)
|
||||
{
|
||||
case ERROR_OPEN:
|
||||
printf("Cannot open file %s\n", name);
|
||||
return -1;
|
||||
case ERROR_READ:
|
||||
printf("Cannot read file %s\n", name);
|
||||
return -2;
|
||||
case ERROR_MEM:
|
||||
printf("Cannot allocate memory\n");
|
||||
return -3;
|
||||
default:
|
||||
printf("Unknown error in file %s\n", name);
|
||||
return -4;
|
||||
}
|
||||
}
|
||||
print_list(head, p);
|
||||
t = clock();
|
||||
res = solve2(head);
|
||||
t = (clock() - t) / CLOCKS_PER_SEC;
|
||||
printf("%s : Task = %d Result = %d Elapsed = %.2f\n", argv[0], task, res, t);
|
||||
free_list(head);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int solve2(node* head)
|
||||
{
|
||||
node* curr;
|
||||
node* prev = head;
|
||||
int count = 0;
|
||||
for (curr = head->next; curr; prev = curr, curr = curr->next)
|
||||
if (strcmp(curr->string, prev->string) > 0) count += 1;
|
||||
return count;
|
||||
}
|
70
2025.05.23/dist/Ulianov_MT/task03.c
vendored
Normal file
70
2025.05.23/dist/Ulianov_MT/task03.c
vendored
Normal file
|
@ -0,0 +1,70 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include "io_status.h"
|
||||
#include "list.h"
|
||||
|
||||
int solve3(node*);
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int task = 3;
|
||||
char* name = 0;
|
||||
node* head = 0;
|
||||
io_status ret;
|
||||
int p;
|
||||
int res;
|
||||
double t;
|
||||
if (!(argc == 3 && sscanf(argv[1], "%d", &p) == 1))
|
||||
{
|
||||
printf("Usage: %s p file\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
name = argv[2];
|
||||
ret = read_list(&head, name);
|
||||
if (ret != SUCCESS)
|
||||
{
|
||||
switch (ret)
|
||||
{
|
||||
case ERROR_OPEN:
|
||||
printf("Cannot open file %s\n", name);
|
||||
return -1;
|
||||
case ERROR_READ:
|
||||
printf("Cannot read file %s\n", name);
|
||||
return -2;
|
||||
case ERROR_MEM:
|
||||
printf("Cannot allocate memory\n");
|
||||
return -3;
|
||||
default:
|
||||
printf("Unknown error in file %s\n", name);
|
||||
return -4;
|
||||
}
|
||||
}
|
||||
print_list(head, p);
|
||||
t = clock();
|
||||
res = solve3(head);
|
||||
t = (clock() - t) / CLOCKS_PER_SEC;
|
||||
printf("%s : Task = %d Result = %d Elapsed = %.2f\n", argv[0], task, res, t);
|
||||
free_list(head);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int solve3(node* head)
|
||||
{
|
||||
node* curr;
|
||||
node* prev = head;
|
||||
node* next;
|
||||
char* curr_str;
|
||||
char* next_str;
|
||||
char* prev_str;
|
||||
int count = 0;
|
||||
for (curr = head->next, next = curr->next; next; prev = curr, curr = next, next = next->next)
|
||||
{
|
||||
curr_str = curr->string;
|
||||
next_str = next->string;
|
||||
prev_str = prev->string;
|
||||
if (strcmp(curr_str, prev_str) >= 0 && strcmp(curr_str, next_str) >= 0) count += 1;
|
||||
}
|
||||
return count;
|
||||
}
|
85
2025.05.23/dist/Ulianov_MT/task04.c
vendored
Normal file
85
2025.05.23/dist/Ulianov_MT/task04.c
vendored
Normal file
|
@ -0,0 +1,85 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include "io_status.h"
|
||||
#include "list.h"
|
||||
|
||||
int solve4(node*);
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int task = 4;
|
||||
char* name = 0;
|
||||
node* head = 0;
|
||||
io_status ret;
|
||||
int p;
|
||||
int res;
|
||||
double t;
|
||||
if (!(argc == 3 && sscanf(argv[1], "%d", &p) == 1))
|
||||
{
|
||||
printf("Usage: %s p file\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
name = argv[2];
|
||||
ret = read_list(&head, name);
|
||||
if (ret != SUCCESS)
|
||||
{
|
||||
switch (ret)
|
||||
{
|
||||
case ERROR_OPEN:
|
||||
printf("Cannot open file %s\n", name);
|
||||
return -1;
|
||||
case ERROR_READ:
|
||||
printf("Cannot read file %s\n", name);
|
||||
return -2;
|
||||
case ERROR_MEM:
|
||||
printf("Cannot allocate memory\n");
|
||||
return -3;
|
||||
default:
|
||||
printf("Unknown error in file %s\n", name);
|
||||
return -4;
|
||||
}
|
||||
}
|
||||
print_list(head, p);
|
||||
t = clock();
|
||||
res = solve4(head);
|
||||
t = (clock() - t) / CLOCKS_PER_SEC;
|
||||
printf("%s : Task = %d Result = %d Elapsed = %.2f\n", argv[0], task, res, t);
|
||||
free_list(head);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int solve4(node* head)
|
||||
{
|
||||
int i;
|
||||
int flag = 0;
|
||||
node* curr;
|
||||
node* prev = head;
|
||||
node* next;
|
||||
char* curr_str;
|
||||
char* next_str;
|
||||
char* prev_str;
|
||||
int begin = 0, max = 0, dist = 0;
|
||||
for (curr = head->next, next = curr->next, i = 0; next; prev = curr, curr = next, next = next->next, i++)
|
||||
{
|
||||
curr_str = curr->string;
|
||||
next_str = next->string;
|
||||
prev_str = prev->string;
|
||||
if (strcmp(curr_str, prev_str) >= 0 && strcmp(curr_str, next_str) >= 0)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
dist = i - begin - 1;
|
||||
if (dist > max) max = dist;
|
||||
begin = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
flag = 1;
|
||||
begin = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return max;
|
||||
}
|
69
2025.05.23/dist/Ulianov_MT/task05.c
vendored
Normal file
69
2025.05.23/dist/Ulianov_MT/task05.c
vendored
Normal file
|
@ -0,0 +1,69 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include "io_status.h"
|
||||
#include "list.h"
|
||||
|
||||
int solve5(node*);
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int task = 5;
|
||||
char* name = 0;
|
||||
node* head = 0;
|
||||
io_status ret;
|
||||
int p;
|
||||
int res;
|
||||
double t;
|
||||
if (!(argc == 3 && sscanf(argv[1], "%d", &p) == 1))
|
||||
{
|
||||
printf("Usage: %s p file\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
name = argv[2];
|
||||
ret = read_list(&head, name);
|
||||
if (ret != SUCCESS)
|
||||
{
|
||||
switch (ret)
|
||||
{
|
||||
case ERROR_OPEN:
|
||||
printf("Cannot open file %s\n", name);
|
||||
return -1;
|
||||
case ERROR_READ:
|
||||
printf("Cannot read file %s\n", name);
|
||||
return -2;
|
||||
case ERROR_MEM:
|
||||
printf("Cannot allocate memory\n");
|
||||
return -3;
|
||||
default:
|
||||
printf("Unknown error in file %s\n", name);
|
||||
return -4;
|
||||
}
|
||||
}
|
||||
print_list(head, p);
|
||||
t = clock();
|
||||
res = solve5(head);
|
||||
t = (clock() - t) / CLOCKS_PER_SEC;
|
||||
printf("%s : Task = %d Result = %d Elapsed = %.2f\n", argv[0], task, res, t);
|
||||
free_list(head);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int solve5(node* head)
|
||||
{
|
||||
node* curr;
|
||||
node* prev = head;
|
||||
int len = 1, max = 0;
|
||||
for (curr = head->next; curr; prev = curr, curr = curr->next)
|
||||
{
|
||||
if (strcmp(curr->string, prev->string) > 0) len += 1;
|
||||
else
|
||||
{
|
||||
if (len > max) max = len;
|
||||
len = 1;
|
||||
}
|
||||
}
|
||||
if (len > max) max = len;
|
||||
return (max == 1 ? 0 : max);
|
||||
}
|
69
2025.05.23/dist/Ulianov_MT/task06.c
vendored
Normal file
69
2025.05.23/dist/Ulianov_MT/task06.c
vendored
Normal file
|
@ -0,0 +1,69 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include "io_status.h"
|
||||
#include "list.h"
|
||||
|
||||
int solve6(node*);
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int task = 6;
|
||||
char* name = 0;
|
||||
node* head = 0;
|
||||
io_status ret;
|
||||
int p;
|
||||
int res;
|
||||
double t;
|
||||
if (!(argc == 3 && sscanf(argv[1], "%d", &p) == 1))
|
||||
{
|
||||
printf("Usage: %s p file\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
name = argv[2];
|
||||
ret = read_list(&head, name);
|
||||
if (ret != SUCCESS)
|
||||
{
|
||||
switch (ret)
|
||||
{
|
||||
case ERROR_OPEN:
|
||||
printf("Cannot open file %s\n", name);
|
||||
return -1;
|
||||
case ERROR_READ:
|
||||
printf("Cannot read file %s\n", name);
|
||||
return -2;
|
||||
case ERROR_MEM:
|
||||
printf("Cannot allocate memory\n");
|
||||
return -3;
|
||||
default:
|
||||
printf("Unknown error in file %s\n", name);
|
||||
return -4;
|
||||
}
|
||||
}
|
||||
print_list(head, p);
|
||||
t = clock();
|
||||
res = solve6(head);
|
||||
t = (clock() - t) / CLOCKS_PER_SEC;
|
||||
printf("%s : Task = %d Result = %d Elapsed = %.2f\n", argv[0], task, res, t);
|
||||
free_list(head);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int solve6(node* head)
|
||||
{
|
||||
node* curr;
|
||||
node* prev = head;
|
||||
int count = 0, flag = 0;
|
||||
for (curr = head->next; curr; prev = curr, curr = curr->next)
|
||||
{
|
||||
if (strcmp(curr->string, prev->string) == 0) flag = 1;
|
||||
else
|
||||
{
|
||||
if (flag == 1) count++;
|
||||
flag = 0;
|
||||
}
|
||||
}
|
||||
if (flag == 1) count++;
|
||||
return count;
|
||||
}
|
69
2025.05.23/dist/Ulianov_MT/task07.c
vendored
Normal file
69
2025.05.23/dist/Ulianov_MT/task07.c
vendored
Normal file
|
@ -0,0 +1,69 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include "io_status.h"
|
||||
#include "list.h"
|
||||
|
||||
int solve7(node*);
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int task = 7;
|
||||
char* name = 0;
|
||||
node* head = 0;
|
||||
io_status ret;
|
||||
int p;
|
||||
int res;
|
||||
double t;
|
||||
if (!(argc == 3 && sscanf(argv[1], "%d", &p) == 1))
|
||||
{
|
||||
printf("Usage: %s p file\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
name = argv[2];
|
||||
ret = read_list(&head, name);
|
||||
if (ret != SUCCESS)
|
||||
{
|
||||
switch (ret)
|
||||
{
|
||||
case ERROR_OPEN:
|
||||
printf("Cannot open file %s\n", name);
|
||||
return -1;
|
||||
case ERROR_READ:
|
||||
printf("Cannot read file %s\n", name);
|
||||
return -2;
|
||||
case ERROR_MEM:
|
||||
printf("Cannot allocate memory\n");
|
||||
return -3;
|
||||
default:
|
||||
printf("Unknown error in file %s\n", name);
|
||||
return -4;
|
||||
}
|
||||
}
|
||||
print_list(head, p);
|
||||
t = clock();
|
||||
res = solve7(head);
|
||||
t = (clock() - t) / CLOCKS_PER_SEC;
|
||||
printf("%s : Task = %d Result = %d Elapsed = %.2f\n", argv[0], task, res, t);
|
||||
free_list(head);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int solve7(node* head)
|
||||
{
|
||||
node* curr;
|
||||
node* prev = head;
|
||||
int len = -1, max = 0, flag = 0;
|
||||
for (curr = head->next; curr; prev = curr, curr = curr->next)
|
||||
{
|
||||
if (strcmp(curr->string, prev->string)) {if (flag == 1) len++;}
|
||||
else
|
||||
{
|
||||
flag = 1;
|
||||
if (len > max) max = len;
|
||||
len = -1;
|
||||
}
|
||||
}
|
||||
return max;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue