I was trying to figure out how to write the code to generate a list for the following code.... let me know if you guys can help?
the question was pick 5 number 1-56 ( No repeats) and an extra number 1-52
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
int cnt = 0;
int x1,x2,x3,x4,x5,y;
for (x1=1;x1<57;x1++)
{
for (x2=x1+1;x2<57;x2++)
{
for (x3=x2+1;x3<57;x3++)
{
for (x4=x3+1;x4<57;x4++)
{
for (x5=x4+1;x5<57;x5++)
{
for (y=1;y<53;y++)
{
if (x1+x2+x3+x4+x5+y == 147)
{
cnt++;
}
}
}
}
}
}
}
printf("%d",cnt);
system("PAUSE");
return 0;
}
As a 7z compressed tarball, it's around 514KiB.
]]>I would say so. You could also zip it up to make it smaller.
]]>Sorry for such a late response.. After our last postings (post 22) I have been crammed with Finals, Papers, Projects and what not.... The project that you guys helped me on was a success , thanks again!...
.. I was wondering (just out of curiosity) since the file would be tremendously large to show all possible solutions, if there is an actual way to break up the solutions to accommodate the file size.
Okay, let me know if I can do something else.
]]>There are 524880 ways to arrange them! That is a very large number.
That is for your problem in post #27. It is quite easy to get the number but to arrange them will require a computer. Do you program?
]]>if l was to do the same for 1,2,3,4,5,6 how many ways will it be all together and can you also help me organise them please?
Many thanks
No formula. And for bigger numbers there may be a lot more permutations, thousands or millions. A formula would only tell how many there are, it would not show what they are.
Using a method, I come up with
That means there are 524880 ways to permute those 6 numbers in those 18 boxes.
]]>Okay, I will work on it and post if I have a solution.
]]>Eg will be
W D A
1 x
2 x
3 x
4 x
5 x
6 x
Many thanks