Home > Software engineering >  Data together close to the set value
Data together close to the set value

Time:09-20

Ask the master to help solve, thank you!

CodePudding user response:

No head no tail, the building composition must fail

CodePudding user response:

Who can help me to solve my head of this problem now? Heavily reward!

CodePudding user response:

Fyi:
//n (2 & lt;=n<=20) integers (integer range - 10 & lt;=x<=10), decide whether you can find some number from the number n, and for 10 
#include
#include
#include
#include
using namespace std;
Int MAXN=20;
Int MINN=2;
Int x [20].
Int n, I, j, k, sum;
Int main () {
Srand ((unsigned) time (NULL));
N=MINN + rand () % (MAXN - 1);
for (i=0; i[I] x=10 + rand () % of 21;
Printf (" % d ", x [I]);
}
printf("\n");
Sort (& amp; X [0], & amp; X [n]);
Do {
For (I=2; i<=n; I++) {
Sum=0;
K=n/2 - I/2;
For (j=k; JThe sum +=x [j];
}
If (10==sum) {
For (j=k; JIf (j==k + I - 1) {
Printf (" % d==10 \ n ", x [j]);
} else {
Printf (" % d +, "x [j]);
}
}
Printf (" YES \ n ");
return 1;
}
}
} while (next_permutation (& amp; X [0], & amp; X [n]));
Printf (" \ n ");
return 0;
}

CodePudding user response:

Baidu search relevant keywords,
  •  Tags:  
  • VBA
  • Related