Add dist and change make_dist
This commit is contained in:
parent
a5ffe19dd8
commit
50e9bb6d59
31 changed files with 996 additions and 1 deletions
32
2025.05.23/dist/Krivoruchenko_SK/solve_03.c
vendored
Normal file
32
2025.05.23/dist/Krivoruchenko_SK/solve_03.c
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
#include "solve_03.h"
|
||||
#include "node.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
int t3_solve (node *head)
|
||||
{
|
||||
char *last = head->string;
|
||||
int count = 0, local = 1;
|
||||
|
||||
for (head = head->next; head; head = head->next)
|
||||
{
|
||||
int cmp = strcmp(head->string, last);
|
||||
if (cmp < 0) {
|
||||
if (local) {
|
||||
count += local;
|
||||
local = 0;
|
||||
}
|
||||
} else if (cmp == 0) {
|
||||
if (local)
|
||||
local++;
|
||||
} else
|
||||
local = 1;
|
||||
|
||||
last = head->string;
|
||||
}
|
||||
|
||||
count += local;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue