Task 7 is done
This commit is contained in:
parent
6f21fa116f
commit
6ef0a8bfb3
17 changed files with 138 additions and 44 deletions
7
2025.05.23/04Ex/input/a.txt
Normal file
7
2025.05.23/04Ex/input/a.txt
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
1
|
||||||
|
5
|
||||||
|
4
|
||||||
|
3
|
||||||
|
2
|
||||||
|
3
|
||||||
|
1
|
||||||
0
2025.05.23/04Ex/input/e.txt
Normal file
0
2025.05.23/04Ex/input/e.txt
Normal file
5
2025.05.23/04Ex/input/f.txt
Normal file
5
2025.05.23/04Ex/input/f.txt
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
5
|
||||||
|
5
|
||||||
|
5
|
||||||
|
5
|
||||||
|
5
|
||||||
9
2025.05.23/04Ex/input/n.txt
Normal file
9
2025.05.23/04Ex/input/n.txt
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
1
|
||||||
|
5
|
||||||
|
4
|
||||||
|
4
|
||||||
|
4
|
||||||
|
4
|
||||||
|
4
|
||||||
|
6
|
||||||
|
1
|
||||||
5
2025.05.23/04Ex/input/o.txt
Normal file
5
2025.05.23/04Ex/input/o.txt
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
5
|
||||||
6
2025.05.23/04Ex/input/s.txt
Normal file
6
2025.05.23/04Ex/input/s.txt
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
1
|
||||||
|
5
|
||||||
|
5
|
||||||
|
5
|
||||||
|
5
|
||||||
|
6
|
||||||
|
|
@ -42,6 +42,11 @@ int t4_solve (node *head)
|
||||||
last = head;
|
last = head;
|
||||||
head = next;
|
head = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strcmp(head->string, last->string) <= 0)
|
||||||
|
if (strict)
|
||||||
|
if (maximum < count)
|
||||||
|
maximum = count;
|
||||||
|
|
||||||
return maximum;
|
return maximum;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,15 +6,21 @@
|
||||||
int t6_solve (node *head)
|
int t6_solve (node *head)
|
||||||
{
|
{
|
||||||
char *last = head->string;
|
char *last = head->string;
|
||||||
int count = 1;
|
int count = 0, local = 0;
|
||||||
|
|
||||||
for (head = head->next; head; head = head->next)
|
for (head = head->next; head; head = head->next)
|
||||||
{
|
{
|
||||||
if (strcmp(head->string, last))
|
if (strcmp(head->string, last) == 0)
|
||||||
count++;
|
local = 1;
|
||||||
|
else {
|
||||||
|
count += local;
|
||||||
|
local = 0;
|
||||||
|
}
|
||||||
last = head->string;
|
last = head->string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
count += local;
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,10 @@
|
||||||
a
|
1
|
||||||
b
|
1
|
||||||
d
|
2
|
||||||
e
|
3
|
||||||
c
|
4
|
||||||
c
|
5
|
||||||
c
|
6
|
||||||
|
6
|
||||||
d
|
6
|
||||||
d
|
6
|
||||||
d
|
|
||||||
d
|
|
||||||
a
|
|
||||||
a
|
|
||||||
a
|
|
||||||
|
|
||||||
|
|
|
||||||
5
2025.05.23/07Ex/input/c.txt
Normal file
5
2025.05.23/07Ex/input/c.txt
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
31
2025.05.23/07Ex/input/m.txt
Normal file
31
2025.05.23/07Ex/input/m.txt
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
5
|
||||||
|
6
|
||||||
|
6
|
||||||
|
1
|
||||||
|
7
|
||||||
|
7
|
||||||
|
1
|
||||||
|
2
|
||||||
|
6
|
||||||
|
6
|
||||||
|
6
|
||||||
|
6
|
||||||
|
3
|
||||||
|
2
|
||||||
|
4
|
||||||
|
5
|
||||||
|
5
|
||||||
|
5
|
||||||
|
5
|
||||||
|
5
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
5
|
||||||
|
6
|
||||||
|
7
|
||||||
5
2025.05.23/07Ex/input/n.txt
Normal file
5
2025.05.23/07Ex/input/n.txt
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
5
|
||||||
11
2025.05.23/07Ex/input/s.txt
Normal file
11
2025.05.23/07Ex/input/s.txt
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
4
|
||||||
|
4
|
||||||
|
4
|
||||||
|
4
|
||||||
|
5
|
||||||
|
6
|
||||||
|
7
|
||||||
|
|
@ -6,23 +6,20 @@
|
||||||
int t7_solve (node *head)
|
int t7_solve (node *head)
|
||||||
{
|
{
|
||||||
char *last = head->string;
|
char *last = head->string;
|
||||||
int maximum = 0, count = 1;
|
int maximum = 0, count = 0, consist = 0;
|
||||||
|
|
||||||
for (head = head->next; head; head = head->next)
|
for (head = head->next; head; head = head->next)
|
||||||
{
|
{
|
||||||
if (strcmp(head->string, last))
|
if (strcmp(head->string, last) == 0) {
|
||||||
count++;
|
if (maximum < count)
|
||||||
else {
|
maximum = count - 1;
|
||||||
if (maximum < (count-1))
|
consist = 1;
|
||||||
maximum = count-1;
|
count = 0;
|
||||||
count = 0;
|
} else
|
||||||
}
|
count += consist;
|
||||||
last = head->string;
|
last = head->string;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maximum < count)
|
|
||||||
maximum = count;
|
|
||||||
|
|
||||||
return maximum;
|
return maximum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
5
2025.05.23/dist/Krivoruchenko_SK/solve_04.c
vendored
5
2025.05.23/dist/Krivoruchenko_SK/solve_04.c
vendored
|
|
@ -42,6 +42,11 @@ int t4_solve (node *head)
|
||||||
last = head;
|
last = head;
|
||||||
head = next;
|
head = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strcmp(head->string, last->string) <= 0)
|
||||||
|
if (strict)
|
||||||
|
if (maximum < count)
|
||||||
|
maximum = count;
|
||||||
|
|
||||||
return maximum;
|
return maximum;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
12
2025.05.23/dist/Krivoruchenko_SK/solve_06.c
vendored
12
2025.05.23/dist/Krivoruchenko_SK/solve_06.c
vendored
|
|
@ -6,15 +6,21 @@
|
||||||
int t6_solve (node *head)
|
int t6_solve (node *head)
|
||||||
{
|
{
|
||||||
char *last = head->string;
|
char *last = head->string;
|
||||||
int count = 1;
|
int count = 0, local = 0;
|
||||||
|
|
||||||
for (head = head->next; head; head = head->next)
|
for (head = head->next; head; head = head->next)
|
||||||
{
|
{
|
||||||
if (strcmp(head->string, last))
|
if (strcmp(head->string, last) == 0)
|
||||||
count++;
|
local = 1;
|
||||||
|
else {
|
||||||
|
count += local;
|
||||||
|
local = 0;
|
||||||
|
}
|
||||||
last = head->string;
|
last = head->string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
count += local;
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
19
2025.05.23/dist/Krivoruchenko_SK/solve_07.c
vendored
19
2025.05.23/dist/Krivoruchenko_SK/solve_07.c
vendored
|
|
@ -6,23 +6,20 @@
|
||||||
int t7_solve (node *head)
|
int t7_solve (node *head)
|
||||||
{
|
{
|
||||||
char *last = head->string;
|
char *last = head->string;
|
||||||
int maximum = 0, count = 1;
|
int maximum = 0, count = 0, consist = 0;
|
||||||
|
|
||||||
for (head = head->next; head; head = head->next)
|
for (head = head->next; head; head = head->next)
|
||||||
{
|
{
|
||||||
if (strcmp(head->string, last))
|
if (strcmp(head->string, last) == 0) {
|
||||||
count++;
|
if (maximum < count)
|
||||||
else {
|
maximum = count - 1;
|
||||||
if (maximum < (count-1))
|
consist = 1;
|
||||||
maximum = count-1;
|
count = 0;
|
||||||
count = 0;
|
} else
|
||||||
}
|
count += consist;
|
||||||
last = head->string;
|
last = head->string;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maximum < count)
|
|
||||||
maximum = count;
|
|
||||||
|
|
||||||
return maximum;
|
return maximum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue