-
Notifications
You must be signed in to change notification settings - Fork 0
task1 #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
task1 #28
Conversation
yurii-litvinov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Технически сложно (+1 балл), но неаккуратно (-1 балл) и неправильный ответ выдаёт (-3 балла) :)
| qsort(newNumber, strlen(newNumber), sizeof(char), compare); | ||
|
|
||
| return newNumber; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не всё так просто. На тесте 10 правильный ответ был бы 10, а у Вас получится 01, что не является корректной записью числа в десятичной системе счисления. Причём, в тестах числа с нулём даже не рассматривались, так что ладно бы Вы неправильно поняли условие и не спросили, но тут, кажется, про это вообще не подумали :)
| @@ -0,0 +1,25 @@ | |||
|
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Лишняя пустая строчка
| @@ -0,0 +1,3 @@ | |||
| #pragma once | |||
|
|
|||
| char * getMinimalNumber(char const * const number); | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Надо комментарии к каждой функции в заголовочном файле
- И что-то тут пробелов многовато
| // int comp (const char element1, const char element2) | ||
| // { | ||
| // if (element1 == element2) | ||
| // { | ||
| // return 0; | ||
| // } | ||
|
|
||
| // return (element1 < element2 ? -1 : 1); | ||
| // } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Закомментированного кода в окончательной версии быть не должно.
| // return (element1 < element2 ? -1 : 1); | ||
| // } | ||
|
|
||
| static clear(void) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| static clear(void) | |
| static int clear(void) |
| free(number); | ||
| if (number == NULL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Технически так тоже будет работать, но я бы сначала делал if, потом free
| // #include <stdio.h> | ||
| // #include <stdlib.h> | ||
|
|
||
| // char values[] = { 5, 4, 7, 1, 2 }; | ||
|
|
||
| // int compare(const void *a, const void *b) | ||
| // { | ||
| // return *(const char *)a - *(const char *)b; | ||
| // } | ||
|
|
||
| // char arr[] = "dbaurjvgeofx"; | ||
|
|
||
| // printf("Unsorted: %s\n", arr); | ||
| // qsort(arr, strlen(arr), 1, compare); | ||
| // printf("Sorted: %s\n", arr); No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:(
| strcpy(copy, string); | ||
| } | ||
| return copy; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strdup
| #pragma once | ||
|
|
||
| #include <stdbool.h> | ||
| #include <string.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это вроде как не нужно в самом .h-файле, так что можно перенести в .c
| const char * const input1 = "564353456"; | ||
| const char * const answer1 = "334455566"; | ||
| const char * const input2 = "5435"; | ||
| const char * const answer2 = "3455"; | ||
|
|
||
| return testCase(input1, answer1) && testCase(input2, answer2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const char * const input1 = "564353456"; | |
| const char * const answer1 = "334455566"; | |
| const char * const input2 = "5435"; | |
| const char * const answer2 = "3455"; | |
| return testCase(input1, answer1) && testCase(input2, answer2); | |
| return testCase("564353456", "334455566") && testCase("5435", "3455"); |
Какие-то лишние церемонии
No description provided.