Skip to content

Kr#2

Open
DolzhenkoAlexa wants to merge 2 commits intomainfrom
kr
Open

Kr#2
DolzhenkoAlexa wants to merge 2 commits intomainfrom
kr

Conversation

@DolzhenkoAlexa
Copy link
Owner

Добавлено два файла для контрольной - max.c и diffPalindrome.c
В первом поиск суммы максимального числа, во втором палиндром в двоичной системе

Долженко Александра

Copy link

@p-senichenkov p-senichenkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Палиндром -- 7/10 (но ставить эту оценку некуда)
Максимальная сумма -- 5/10
Обезьяньей сортировки здесь нет

This comment was marked as resolved.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вы не добавили решение этой задачи на HWProj, так что поставить оценку не получится


int systemChangerTo2(int n) {
int binaryNum[1000]; //Массив для числа во вторичной
char charBinaryNum[1000]; // Массив для числа во вторичной, но в виде строки

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Зачем нужно два представления? Вполне хватит какого-то одного.

} else {
return 0;
}
if (left > right) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это условие уже проверяется в заголовке цикла. Второй раз его проверять не нужно.

Comment on lines +15 to +22
while (temp / 10 != 0) { // "Резатель числа", режем - пока оно не станет нулевым, прибавляем хвостик к сумме
tempSum += (temp % 10);
temp = temp/10;
printf("Sum %d\n", tempSum);
printf("%d \n", temp);
}
tempSum = temp + tempSum;
printf("Sum %d\n", tempSum);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Ваша программа выводит ответ в stdin, так что отладочный вывод лучше убрать.
  2. Этот код можно упростить, если использовать более естественное условие в цикле.

int maxSum = finder(arr, size);

printf("\n");
printf("Max sum of numbers %d", maxSum);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Выводится вообще не то, что нужно по условию.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants