#include <stdio.h>
#include <stdlib.h>
void endless() {
int a, b, c, d, e;
for (a = 1; a < 6; ++a)
for (b = 1; b < 6; ++b)
for (c = 1; c < 6; ++c)
for (d = 1; d < 6; ++d)
for (e = 1; e < 6; ++e) {
if (((a == 3) ^ (b == 2))
&& ((b == 2) ^ (e == 4))
&& ((c == 1) ^ (d == 2))
&& ((c == 5) ^ (d == 3))
&& ((e == 4) ^ (a == 1))) {
//abcde不重复
if (a*b*c*d*e == 120) {
printf("A=%d,B=%d,C=%d,D=%d,E=%d\n", a, b, c, d, e);
}
}
}
}
int main() {
endless();
system("pause");
return 0;
}
A=3,B=1,C=5,D=2,E=4
请按任意键继续. . .