Answer the question
In order to leave comments, you need to log in
What could be alternative ways to solve this problem?
Attention! This is NOT a task, you DO NOT need to write code that solves this problem, I'm interested in alternative IDEAS for solving the problem, not their implementation.
There are two numbers, let N and S. S is the cost of a certain product, N is the number of coins 1...N, that is, 1,2,3...
N :
N=3
S=5
Варианты:
2+3=5
________________________
N=4
S=4
Варианты:
1) 4=4
2) 1+3=4
Answer the question
In order to leave comments, you need to log in
I think all the options are here: the possible sums of numbers
are also very important here, that in N, if there can be any integer, this is one option. If fractional, another. If there are all possible integers, but no more than the value of S - the third one. As far as I understand the third option. That is, you need to calculate all possible combinations to get the sum of two integers equal to S.
By the way, there is a cool video, mathematical methods for calculating the probability of getting a "lucky ticket" in transport are analyzed. In fact, your case, since it is the calculation of possible amounts:
https://www.youtube.com/watch?v=mqnnCdIlBKU (watch from the 3rd minute, there are a lot of lyrics at the beginning) I can’t say that the situation is 1v1, but the calculation method will be the same.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question