Suppose there are n people in total, three people in a row, five people in a row, and seven people in a row. See if there are a, b, c people left in the last row Isn’t it
n % 3 = a
n % 5 = b
n % 7 = c
Isn’t the following very simple? Method 1: Brute Force n Try everything from 10 to 100. I don’t need to say this anymore
This. . . I don’t know how to put it. . .
Suppose there are n people in total, three people in a row, five people in a row, and seven people in a row. See if there are a, b, c people left in the last row
Isn’t it
Isn’t the following very simple?
Method 1: Brute Force
n Try everything from 10 to 100. I don’t need to say this anymore
Method 2: Mathematical method (Solving Congruence Expressions - Elementary Mathematics)
Example:
n % 3 = 2
n % 5 = 4
What can it be converted into?
If there are three, count two first, then the third.