01 02 03 04 05 + take first row
01 02 03 04 06 - in second row, 3 or more same with first row dont want this
01 02 03 04 07 - in third row, 3 or more same with first row I dont want this
01 02 03 04 08 -
01 02 03 05 06 -
01 02 03 05 07 - (I want program to write signed with +)
01 02 03 05 08 - 3 same with upper thats why dont want this and proggram
01 02 03 06 07 - will not write this (shortly I dont want - signed
01 02 03 06 08 -
01 02 03 07 08 -
01 02 04 05 06 - I did this manualy
01 02 04 05 07 -
01 02 04 05 08 - I want result like this
01 02 04 06 07 -
01 02 04 06 08 - 01 02 03 04 05 (first row)
01 02 04 07 08 - 01 04 06 07 08 (34 row)
01 02 05 06 07 -
01 02 05 06 08 -
01 02 05 07 08 -
01 02 06 07 08 -
01 03 04 05 06 -
01 03 04 05 07 -
01 03 04 05 08 -
01 03 04 06 07 -
01 03 04 06 08 -
01 03 04 07 08 -
01 03 05 06 07 -
01 03 05 06 08 -
01 03 05 07 08 -
01 03 06 07 08 -
01 04 05 06 07 -
01 04 05 06 08 -
01 04 05 07 08 -
01 04 06 07 08 +
01 05 06 07 08 -
02 03 04 05 06 -
02 03 04 05 07 -
02 03 04 05 08 -
02 03 04 06 07 -
02 03 04 06 08 -
02 03 04 07 08 -
02 03 05 06 07 -
02 03 05 06 08 -
02 03 05 07 08 -
02 03 06 07 08 -
02 04 05 06 07 -
02 04 05 06 08 -
02 04 05 07 08 -
02 04 06 07 08 -
02 05 06 07 08 -
03 04 05 06 07 -
03 04 05 06 08 -
03 04 05 07 08 -
03 04 06 07 08 -
03 05 06 07 08 -
04 05 06 07 08 -
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
const int NMAX = 8;
int i = 0;
//Choose ONE of the following
//ofstream out( "outputt.txt" ); // for file
ostream & out = cout; // for screen
for ( int a = 1; a <= NMAX - 2; a++ )
{
for ( int b = a + 1; b <= NMAX - 1; b++ )
{
for ( int c = b + 1; c <= NMAX; c++ )
{
for ( int d = c + 1; d <= NMAX; d++ )
{
for ( int e = d + 1; e <= NMAX; e++ )
{
int n = 100 * a + 10 * b + c + d + e;
i++;
//out << i << ": " << n << '\n';
out << i << ": " << a << " " << b << " " << c << " " << d << " " << e << '\n';
To avoid this becoming a classic XY problem http://xyproblem.info/
could you state what you are actually trying to do, not what you have (mis)coded.
BTW, please put your code in code tags (first item in the format menu; works except for an initial post, but that can easily be edited). I really don't enjoy alignments like
is 08 the largest value or just an example?
if the values are something simple like 0-8, you can just remap all the rows into bits of an integer, and then do logic (like bitwise xor, then count the bits that are 1, which may be something your cpu can do for you cheap) to get the answer.
another approach is some sort of pre-filtering. find some sort of row-wise hash that lets you know that 2 rows are candidates to be eliminated (this won't do it but for example sum the digits, it won't be THAT easy but some playtime will find something) and then check the candidates against each other. This should give you a high quality result … false means they can't possibly have 3 matches, true means a 75% or better chance they do have 3, that sort of thing... this takes time and effort to figure out, but isn't hard to code once you see something usable.