来自不同国家的4位留学生A,B,C,D在一起交谈,他们每人只会中、英、法、日4种语言中的2种,情况是

来自不同国家的4位留学生A,B,C,D在一起交谈,他们每人只会中、英、法、日4种语言中的2种,情况是:没有人既能讲日语又能讲法语;A能讲日语,D不会日语,但A和D能互相交谈,B不会英语,但A和C交谈时却要B当翻译;B,C,D3人想互相交谈,但找不到共同的语言;只有一种语言3人都会。请编程确定这四人分别会哪两种语言。
请用穷举法 谢谢
请用C语言编写 急急急!!

#include <stdio.h>

void deal(void)
{
int a[4][2];
int i, j, k, n, m, x, y, z, t, k1, k2, k3, k4, k5;

a[0][0] = 3;
// 用 0 1 2 3 分别代表 中 英 法 日
// 数组a[4][2] 代表有四个人 存放两种语言 这个 方法 真的 不是很好 但思想 差不多 楼主 自己 改改
for (i = 0; i < 3; i++)
{
a[0][1] = i; //第一个的赋值

for (j = 0; j < 3; j++)
{
if (j == 1)
{
j = j + 1;
}
a[1][0] = j;

for (k = j + 1; k < 4; k++)
{
if (k == 1)
{
k = k + 1;
}
a[1][1] = k;

for (m = 0; m < 3; m++)
{
a[2][0] = m;

for (n = m + 1; n < 4; n++)
{
a[2][1] = n;// 第三个的赋值

for (t = 0; t < 2; t++)
{
a[3][0] = t;

for (k1 = t + 1; k1 < 3; k1++)
{
z = 0;
x = 0;
a[3][1] = k1;
k5 = 0;
if (a[0][0] == a[3][0] || a[0][0] == a[3][1] || a[0][1] == a[3][0] || a[0][1] == a[3][1])// A D 能够讲话
{
x++;
}

if (a[0][0] != a[2][0] && a[0][0] != a[2][1] && a[0][1] != a[2][0] && a[0][1] != a[2][1]) // A C 不能交谈
{

if (a[1][0] == a[0][0] || a[1][0] == a[0][1] || a[1][1] == a[0][0] || a[1][1] == a[0][1]) // A B 翻译
{
if (a[1][0] == a[2][0] || a[1][0] == a[2][1] || a[1][1] == a[2][0] || a[1][1] == a[2][1]) // B C翻译
{
x++;
}
}

}

for (k2 = 0; k2 < 2; k2++) //b c d 不能相互交流 不是 注意理解
{
for (k3 = 0; k3 < 2; k3++)
{
for (k4 = 0; k4 < 2; k4++)
{
if (a[1][k3] == a[2][k4] == a[3][k4])
{
k5 = 1;
}
}
}
}
if (x == 2 && k5 == 0)
{
for (x = 0; x < 4; x++)
{
for ( y = 0; y < 2; y++)
{
printf("%d ", a[x][y]);
}
printf("\n");
}
printf("\n\n");
}
}
}
}
}
}
}
}
}

int main(void)
{
deal();
}
// 这个方法不是很好 可以用循环来判断只是写了 就没管了 我没实际检验 如有问题 改改就行
温馨提示:答案为网友推荐,仅供参考
第1个回答  2011-06-21
10分...估计没那个动力
第2个回答  2011-06-20
Point guard Jason Kidd has turn out to be the strongest within the history?

Jason - Jason Kidd, championship

38-year-old Jason - Jason Kidd's efficiency throughout the growing season for all to see, since the initiator with the championship team's offense, he completed this job nicely, now, a championship ring is made for the existing Kidd is the best reward.

For Kidd,wholesale max shoes, his achievements never have the ability to lead him to the league's history 1 of the greatest point guards, especially Whilst this championship ring, even his fantastic weight adds considerable weight. And with the championship title Kidd,wholesale sunglasses, whether cast from the "history's greatest point guard" behind the "one" mean? "Basket within the world" expert Jason - Fleming was the author with this proposition own analysis, just as a essay questions, he was cautious to use all of the data analysis, and the final conclusion can be fairly representative, The following is Chris Duncan - First, let Kidd Thus far some sort of career:

In the 17 season, Kidd averaged 13.2 points and contributed 9.1 assists,drop ship wholesalers, 6.five rebounds and 2.0 steals. Meanwhile,wholesale jeans, Kidd assists in the season standings are ranked initial 5 times, 3 times a season standings the very first total assists, total steals last season standings 1 initial. In his career, Kidd is shooting very satisfactory, reaching 40.1%, 34.8% third of hit rate. Well known is the fact that Kidd will be the active players in triple-double king, a total of 107 career triple-double in the history of 3 pairs of ranking second simply to Oscar - Robertson and the "Magic" Johnson. As a point guard, Kidd's rebounding completely can't be ignored, the whole ranking in the reputation rebounding, Kidd was able to row all of the players in the first 55. Standings in the good reputation for total assists, Kidd assists ranked second with 11,578, ranked initial in the former Jazz player John - Stockton. The entire steals in the standings,wholesale jerseys, Kidd steals third places 2477, ranking second behind the "god of basketball" - Nike jordan 37 steals. It is worth mentioning that ranked first in steals can be Stockton and Jason Kidd will have no opportunity to look beyond him.
第3个回答  2011-06-21
vf

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网