#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
//A选手说:B第二,我第三;
//B选手说:我第二,E第四;
//C选手说:我第一,D第二;
//D选手说:C最后,我第三;
//E选手说:我第四,A第一;
void Judge()
{
int a = 1;
int b = 1;
int c = 1;
int d = 1;
int 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 ((1 == (b == 2) + (a == 3)) && (1 == (b == 2) + (e == 4)) && (1 == (c == 1) + (d == 2)) && (1 == (c == 5) + (d == 3)) && (1 == (e == 4) + (a == 1)))
{
if (a!=b&&a!=c&&a!=d&&a!=e&&b!=c&&b!=d&&b!=e&&c!=d&&c!=e&&d!=e)
{
printf(“a=%d b=%d c=%d d=%d e=%d\n”, a, b, c, d, e);
}
}
}
}
int main()
{
Judge();
system(“pause”);
return 0;
}
c语言解决跳水法官问题
最新推荐文章于 2022-09-12 21:14:53 发布