Combination of sum of sets
up vote
0
down vote
favorite
There are n
number of sets with 4 elements where the set are fixed.
A = {10, 0, 5, 2}
B = {5, 2, 4, 8}
C = {3, 5, 7, 0}
D = {4, 3, 0, 9}
E = {0, 2, 0, 1}
F = {3, 0, 9, 2}
G = {1, 0, 2, 3}
H = {3, 1, 0, 2}
.
.
.
n
I would like to generate the combination of m
sets of designated sum with the following rules:
- The designated sum is inputed by user
- Each set can only be used once
- 4 sets in maximum to reach the sum
- It can be equal or larger than the sum
For example, I want to generate the following sum.
{13, 5, 12, 2}
{8, 5, 4, 13}
{3, 1, 8, 2}
.
.
.
m
After the calculation, the combination of each set will be resulted.
{13, 5, 12, 2} = A,C = {10+3, 0+5, 5+7, 2+0} = {13, 5, 12, 2}
{8, 5, 4, 13} = B,D = {5+4, 2+3, 4+0, 8+9} = {9, 5, 4, 15}
{7, 3, 10, 8} = E,F,G,H = {0+3+1+3, 2+0+0+1, 0+9+2+0, 1+2+3+2} = {7, 3, 11, 8}
What will be the best way and easiest to perform the calculation?
set combinations
add a comment |
up vote
0
down vote
favorite
There are n
number of sets with 4 elements where the set are fixed.
A = {10, 0, 5, 2}
B = {5, 2, 4, 8}
C = {3, 5, 7, 0}
D = {4, 3, 0, 9}
E = {0, 2, 0, 1}
F = {3, 0, 9, 2}
G = {1, 0, 2, 3}
H = {3, 1, 0, 2}
.
.
.
n
I would like to generate the combination of m
sets of designated sum with the following rules:
- The designated sum is inputed by user
- Each set can only be used once
- 4 sets in maximum to reach the sum
- It can be equal or larger than the sum
For example, I want to generate the following sum.
{13, 5, 12, 2}
{8, 5, 4, 13}
{3, 1, 8, 2}
.
.
.
m
After the calculation, the combination of each set will be resulted.
{13, 5, 12, 2} = A,C = {10+3, 0+5, 5+7, 2+0} = {13, 5, 12, 2}
{8, 5, 4, 13} = B,D = {5+4, 2+3, 4+0, 8+9} = {9, 5, 4, 15}
{7, 3, 10, 8} = E,F,G,H = {0+3+1+3, 2+0+0+1, 0+9+2+0, 1+2+3+2} = {7, 3, 11, 8}
What will be the best way and easiest to perform the calculation?
set combinations
This looks like an interesting problem. What have you tried?
– Joseph Wood
Nov 12 at 22:26
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
There are n
number of sets with 4 elements where the set are fixed.
A = {10, 0, 5, 2}
B = {5, 2, 4, 8}
C = {3, 5, 7, 0}
D = {4, 3, 0, 9}
E = {0, 2, 0, 1}
F = {3, 0, 9, 2}
G = {1, 0, 2, 3}
H = {3, 1, 0, 2}
.
.
.
n
I would like to generate the combination of m
sets of designated sum with the following rules:
- The designated sum is inputed by user
- Each set can only be used once
- 4 sets in maximum to reach the sum
- It can be equal or larger than the sum
For example, I want to generate the following sum.
{13, 5, 12, 2}
{8, 5, 4, 13}
{3, 1, 8, 2}
.
.
.
m
After the calculation, the combination of each set will be resulted.
{13, 5, 12, 2} = A,C = {10+3, 0+5, 5+7, 2+0} = {13, 5, 12, 2}
{8, 5, 4, 13} = B,D = {5+4, 2+3, 4+0, 8+9} = {9, 5, 4, 15}
{7, 3, 10, 8} = E,F,G,H = {0+3+1+3, 2+0+0+1, 0+9+2+0, 1+2+3+2} = {7, 3, 11, 8}
What will be the best way and easiest to perform the calculation?
set combinations
There are n
number of sets with 4 elements where the set are fixed.
A = {10, 0, 5, 2}
B = {5, 2, 4, 8}
C = {3, 5, 7, 0}
D = {4, 3, 0, 9}
E = {0, 2, 0, 1}
F = {3, 0, 9, 2}
G = {1, 0, 2, 3}
H = {3, 1, 0, 2}
.
.
.
n
I would like to generate the combination of m
sets of designated sum with the following rules:
- The designated sum is inputed by user
- Each set can only be used once
- 4 sets in maximum to reach the sum
- It can be equal or larger than the sum
For example, I want to generate the following sum.
{13, 5, 12, 2}
{8, 5, 4, 13}
{3, 1, 8, 2}
.
.
.
m
After the calculation, the combination of each set will be resulted.
{13, 5, 12, 2} = A,C = {10+3, 0+5, 5+7, 2+0} = {13, 5, 12, 2}
{8, 5, 4, 13} = B,D = {5+4, 2+3, 4+0, 8+9} = {9, 5, 4, 15}
{7, 3, 10, 8} = E,F,G,H = {0+3+1+3, 2+0+0+1, 0+9+2+0, 1+2+3+2} = {7, 3, 11, 8}
What will be the best way and easiest to perform the calculation?
set combinations
set combinations
asked Nov 12 at 18:34
leo93213
11
11
This looks like an interesting problem. What have you tried?
– Joseph Wood
Nov 12 at 22:26
add a comment |
This looks like an interesting problem. What have you tried?
– Joseph Wood
Nov 12 at 22:26
This looks like an interesting problem. What have you tried?
– Joseph Wood
Nov 12 at 22:26
This looks like an interesting problem. What have you tried?
– Joseph Wood
Nov 12 at 22:26
add a comment |
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53268125%2fcombination-of-sum-of-sets%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53268125%2fcombination-of-sum-of-sets%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
This looks like an interesting problem. What have you tried?
– Joseph Wood
Nov 12 at 22:26