-
Notifications
You must be signed in to change notification settings - Fork 41
Панин Максим #13
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
Панин Максим #13
Conversation
src/two-sum.cpp
Outdated
| @@ -0,0 +1,39 @@ | |||
| #include <iostream> | |||
| #define ARRAY_SIZE 5 | |||
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.
Можно подключить заголовочный файл two-sum.hpp и не дублировать определение макроса
src/two-sum.cpp
Outdated
| @@ -0,0 +1,39 @@ | |||
| #include <iostream> | |||
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.
Заголовочный файл не используется
src/two-sum.cpp
Outdated
| std::size_t& index1 | ||
| ) | ||
| { | ||
| unsigned int kolvo_par = 0; |
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.
Зачем считаете количество пар? По условию задачи подойдет любая пара
src/two-sum.cpp
Outdated
| bool proverka_par = false; | ||
| for (unsigned int i = 0; i <= ARRAY_SIZE - 1; i++) | ||
| { | ||
| for (unsigned int j = i + 1; j <= ARRAY_SIZE; j++) |
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.
Условие должно быть < ARRAY_SIZE. Сейчас имеем выход за границы массива, что показывают тесты
src/two-sum.cpp
Outdated
| { | ||
| for (unsigned int i = 0; i < ARRAY_SIZE; i++) | ||
| { | ||
| for (unsigned int j = i + 1; j <= ARRAY_SIZE; j++) |
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, и до 5(ARRAY_SIZE) будет всего 6 чисел, а не 5, как должно быть
|
Задание принято |
No description provided.