diff --git a/du1/output/program.exe b/du1/output/program.exe index e9ad880..cd4231a 100644 Binary files a/du1/output/program.exe and b/du1/output/program.exe differ diff --git a/du2/program.c b/du2/program.c index c474ff3..13ce3ae 100644 --- a/du2/program.c +++ b/du2/program.c @@ -10,11 +10,11 @@ struct pizza { }; int read_pizza_list(struct pizza* list) { - int counter = 0; - char line[200]; + int counter = 0; // считает, сколько пицц реально прочитано + char line[200]; // буфер для строк for (int i=0; i < LIST_SIZE; i++) { struct pizza item; - memset(&item,0,sizeof(struct pizza)); + memset(&item,0,sizeof(struct pizza)); //заполняем память нулями if (fgets(line, sizeof(line), stdin)==NULL) { break; } diff --git a/du5/a_station.c b/du5/a_station.c index 24f1b68..ed0c1c6 100644 --- a/du5/a_station.c +++ b/du5/a_station.c @@ -10,11 +10,11 @@ struct station* create_station() { return s; } -int select_track(struct station* s, const char* target) { +int select_track(struct station* s, const char* target) { //в какой bucket положить строку. unsigned long hash = 5381; //5381 это алгоритм DJB2 int c; - while ((c = *target++)) { // не забываем ++ чтобы идти по строке + while ((c = *target++)) { hash = ((hash << 5) + hash) + c; //hash << 5 сдвигает все биты числа hash на 5 позиций влево. Это тоже самое, что умножить на 2 в пятой степени } @@ -53,7 +53,7 @@ void add_target_capacity(struct station* s, const char* target, int capacity) { prev->next = new_car; } -int get_target_capacity(struct station* s, const char* target) { +int get_target_capacity(struct station* s, const char* target) { //ищет станцию и возвращает её capacity. if (!s || !target) return 0; int index = select_track(s, target); diff --git a/du6/program.c b/du6/program.c index 01498f3..1c8bd79 100644 --- a/du6/program.c +++ b/du6/program.c @@ -19,11 +19,11 @@ static TreeNode* read_tree_node() { if (buffer[0] == '\n' || buffer[0] == '\r') return NULL; - TreeNode *node = calloc(1, sizeof(TreeNode)); + TreeNode *node = calloc(1, sizeof(TreeNode)); //Создаём новый узел дерева. if (!node) exit(1); - strncpy(node->text, buffer, MAXLINE - 1); + strncpy(node->text, buffer, MAXLINE - 1); //M чтобы оставить место для \0 if (node->text[0] == '*') { node->yes_branch = NULL; @@ -43,7 +43,7 @@ static void free_tree(TreeNode *root) { free(root); } -static int count_leafs(TreeNode *root) { +static int count_leafs(TreeNode *root) { //количество ответов if (!root) return 0; if (!root->yes_branch && !root->no_branch) return 1; diff --git a/sk2/Makefile b/sk2/Makefile new file mode 100644 index 0000000..e69de29 diff --git a/sk2/calculator.c b/sk2/calculator.c new file mode 100644 index 0000000..e69de29 diff --git a/sk2/calculator.h b/sk2/calculator.h new file mode 100644 index 0000000..e69de29 diff --git a/sk2/main.c b/sk2/main.c new file mode 100644 index 0000000..e69de29