5 athletes took part in the 10-meter diving competition, and someone asked them to predict the outcome of the game a contestant said: B First, I'm third. B contestant said: I second, e fourth. C contestant said: I first, d second. D contestant said: C Finally, I third. E contestant said: I am four, a first. After the game is over, each player is half right, please program to determine the position of the match. #include <stdio.h> #include <stdlib.h>int main () {int a, b, c, d, e = 1;for (a = 1; a <= 5; a++) {for (b = 1; b <= 5; b++) {for (c = 1; c <= 5; c++) {for (d = 1; d <= 5; d++) {for (e = 1; e <= 5; e++) {if ((b == 1) + (a == 3) == 1 && (b == 2) + (e == 4) == 1 && (c == 1) + (d == &NBSP;2) == 1 && (c == 5) + (d == 3) == 1 && (e == 4) + (a == 1) == 1) {printf ("a=%d,b=%d,c=%d,d=%d,e=%d\n ", a, b, c, d, e); System ("pause"); return 0;}}}} return 1;}
Operation Result:
A = 2, B = 1, c = 1, d = 3, E = 4
Please press any key to continue ...
Programming to determine tournament order