Open
Conversation
chernishev
reviewed
Oct 27, 2025
2_StyleGid/Tickets
Outdated
Collaborator
There was a problem hiding this comment.
бинарные файлы не коммитим
chernishev
requested changes
Oct 27, 2025
2_StyleGid/luckyTickets.c
Outdated
|
|
||
| int main(void) | ||
| { | ||
| printf("Введите число от 0 до 27:\t"); |
Collaborator
There was a problem hiding this comment.
это не "подсчётом числа билетов с заданной суммой трёх цифр"
0d8e48a to
ea1e13c
Compare
p-senichenkov
requested changes
Dec 13, 2025
2_StyleGid/luckyTickets.c
Outdated
| for (int z1 = 0; z1 <= 9; z1++) { // первая цифра | ||
| for (int z2 = 0; z2 <= 9; z2++) { // вторая цифра | ||
| for (int z3 = 0; z3 <= 9; z3++) { // третья цифра | ||
| if ((z1 <= z2) && (z2 <= z3)) { // чтобы не было повторов (мы же сочетания считаем) |
Collaborator
There was a problem hiding this comment.
Чтобы не было повторов, надо правильно написать условие цикла (т. е. инициализировать переменные не нулём).
Но это неправильный подход. Нам как раз нужно считать повторы. Так программа сожжёт немножко немножко больше электричества, но зато код станет сильно проще.
| } | ||
|
|
||
| for (int summ = 1; summ <= 27; summ++) { // а теперь не берем нулевую сумму | ||
| fullCount += oneSummCount[summ] * oneSummCount[summ]; |
Collaborator
There was a problem hiding this comment.
Это можно сделать сразу при подсчёте сумм. Не надо делать лишний проход.
Owner
Author
There was a problem hiding this comment.
не совсем понимаю как, если мы сначала добавляем всё, а потом возводи в квадрат
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Моё решение задачи про счастливые билетики.