逻辑题:六个男人和六个女人,该怎么处理
逻辑题:六个男人和六个女人
见图片,
有六个男人,简称A,B,C,D,E,F.和他们的母亲只在同一个村子。
每位母亲dou'不幸丧夫,但都又婚。第二任丈夫是除了自己儿子以外的那五个男人的一个。
D太太对C的母亲说: 由于第二次婚姻,她(D太太)成了E太太的婆婆的婆婆的婆婆,A成了B的继父的继父,而F太太成了C太太的儿媳妇的儿媳妇的儿媳妇的儿媳妇。
问谁嫁给了谁?
------解决方案--------------------
c取了a妈,a取了d妈,d取了b妈,b取了f妈,f取了e妈,e取了c妈。。。
这个其实产生了一个环了,12个人谁都可以是谁的长辈,就看怎么从哪边算了
------解决方案--------------------
你确认你的题目是正确的?
我认为题目出错了(搜索了一下也未找到出处)
$dict = array('A', 'B', 'C', 'D', 'E', 'F');<br /> <br /> //搜索 F太太成了C太太的儿媳妇的儿媳妇的儿媳妇的儿媳妇<br /> $st = array(<br /> array('F' => 'A'),<br /> array('F' => 'B'),<br /> array('F' => 'C'),<br /> array('F' => 'D'),<br /> array('F' => 'E'),<br /> );<br /> <br /> while($rs = array_shift($st)) {<br /> $len = count($rs);<br /> $k = end($rs);<br /> if(isset($rs[$k])) continue;<br /> foreach($dict as $v) {<br /> if($k == $v <br><font color='#FF8000'>------解决方案--------------------</font><br> in_array($v, $rs)) continue;<br /> if($len == 4 && $v == 'C') $res[] = array_merge($rs, array($k => $v));<br /> else $st[] = array_merge($rs, array($k => $v));<br /> }<br /> }<br /> //搜索结束,共 24 组<br /> <br /> foreach($res as $i=>$r) {<br /> //配齐 6 个<br /> $k = current(array_diff($dict, array_keys($r)));<br /> $v = current(array_diff($dict, $r));<br /> if($k == $v) continue;<br /> $r = array_merge($r, array($k => $v));<br /> //判断,两个条件不能同时满足<br /> if($r[$r['B']] == 'A' && $r[$r[$r['D']]] == 'E') print_r($r);<br /> //但分别可以<br /> // if($r[$r['B']] == 'A') print_r($r); //A成了B的继父的继父<br /> // if($r[$r[$r['D']]] == 'E') print_r($r); //D太太成了E太太的婆婆的婆婆的婆婆<br /> }<br />
如是程序有错,请指正
------解决方案--------------------
我算过了,有两种答案
我们用大写代表母亲,小写代表儿子,因为题上说了第二任丈夫都是其他五个男人中的一个,所以 当用儿子->媳妇->儿子->媳妇这样的方式连下来,最后应该是一个有12个点的链。我们用?号表示未知的。
第一个信息:D太太是E太太的婆婆的婆婆的婆婆。
所得到链 D->d->?->?->?->?->E->e 共8个点,4个连着未知
第二个信息:a成了b的继父的继父
所得到链 A->a->?->?->B->b 共6个点,2个连着未知
第三个信息:F太太是C太太的儿媳妇的儿媳妇的儿媳妇的儿媳妇
所得到链 C->c->?->?->?->?->?->?->F->f 共10个点 6个连着未知
接下来就是把这三条链和为一条(总共12个点的链),第三天刚好有个6连未知,因此第二条链可以符合,符合后中间两个连着未知距离外面分别是4个点,正好也和第一条符合,但是位置不定,因此有两种结果,分别是:
1: C->c->A->a->D->d->B->b->F->f->E->e
2: D->d->C->c->A->a->E->e->B->b->F->f
符合条件,

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The message "Your organization has asked you to change your PIN" will appear on the login screen. This happens when the PIN expiration limit is reached on a computer using organization-based account settings, where they have control over personal devices. However, if you set up Windows using a personal account, the error message should ideally not appear. Although this is not always the case. Most users who encounter errors report using their personal accounts. Why does my organization ask me to change my PIN on Windows 11? It's possible that your account is associated with an organization, and your primary approach should be to verify this. Contacting your domain administrator can help! Additionally, misconfigured local policy settings or incorrect registry keys can cause errors. Right now

Windows 11 brings fresh and elegant design to the forefront; the modern interface allows you to personalize and change the finest details, such as window borders. In this guide, we'll discuss step-by-step instructions to help you create an environment that reflects your style in the Windows operating system. How to change window border settings? Press + to open the Settings app. WindowsI go to Personalization and click Color Settings. Color Change Window Borders Settings Window 11" Width="643" Height="500" > Find the Show accent color on title bar and window borders option, and toggle the switch next to it. To display accent colors on the Start menu and taskbar To display the theme color on the Start menu and taskbar, turn on Show theme on the Start menu and taskbar

By default, the title bar color on Windows 11 depends on the dark/light theme you choose. However, you can change it to any color you want. In this guide, we'll discuss step-by-step instructions for three ways to change it and personalize your desktop experience to make it visually appealing. Is it possible to change the title bar color of active and inactive windows? Yes, you can change the title bar color of active windows using the Settings app, or you can change the title bar color of inactive windows using Registry Editor. To learn these steps, go to the next section. How to change title bar color in Windows 11? 1. Using the Settings app press + to open the settings window. WindowsI go to "Personalization" and then

Do you see "A problem occurred" along with the "OOBELANGUAGE" statement on the Windows Installer page? The installation of Windows sometimes stops due to such errors. OOBE means out-of-the-box experience. As the error message indicates, this is an issue related to OOBE language selection. There is nothing to worry about, you can solve this problem with nifty registry editing from the OOBE screen itself. Quick Fix – 1. Click the “Retry” button at the bottom of the OOBE app. This will continue the process without further hiccups. 2. Use the power button to force shut down the system. After the system restarts, OOBE should continue. 3. Disconnect the system from the Internet. Complete all aspects of OOBE in offline mode

Taskbar thumbnails can be fun, but they can also be distracting or annoying. Considering how often you hover over this area, you may have inadvertently closed important windows a few times. Another disadvantage is that it uses more system resources, so if you've been looking for a way to be more resource efficient, we'll show you how to disable it. However, if your hardware specs can handle it and you like the preview, you can enable it. How to enable taskbar thumbnail preview in Windows 11? 1. Using the Settings app tap the key and click Settings. Windows click System and select About. Click Advanced system settings. Navigate to the Advanced tab and select Settings under Performance. Select "Visual Effects"

We all have different preferences when it comes to display scaling on Windows 11. Some people like big icons, some like small icons. However, we all agree that having the right scaling is important. Poor font scaling or over-scaling of images can be a real productivity killer when working, so you need to know how to customize it to get the most out of your system's capabilities. Advantages of Custom Zoom: This is a useful feature for people who have difficulty reading text on the screen. It helps you see more on the screen at one time. You can create custom extension profiles that apply only to certain monitors and applications. Can help improve the performance of low-end hardware. It gives you more control over what's on your screen. How to use Windows 11

Screen brightness is an integral part of using modern computing devices, especially when you look at the screen for long periods of time. It helps you reduce eye strain, improve legibility, and view content easily and efficiently. However, depending on your settings, it can sometimes be difficult to manage brightness, especially on Windows 11 with the new UI changes. If you're having trouble adjusting brightness, here are all the ways to manage brightness on Windows 11. How to Change Brightness on Windows 11 [10 Ways Explained] Single monitor users can use the following methods to adjust brightness on Windows 11. This includes desktop systems using a single monitor as well as laptops. let's start. Method 1: Use the Action Center The Action Center is accessible

Many users will choose the Huawei brand when choosing smart watches. Among them, Huawei GT3pro and GT4 are very popular choices. Many users are curious about the difference between Huawei GT3pro and GT4. Let’s introduce the two to you. . What are the differences between Huawei GT3pro and GT4? 1. Appearance GT4: 46mm and 41mm, the material is glass mirror + stainless steel body + high-resolution fiber back shell. GT3pro: 46.6mm and 42.9mm, the material is sapphire glass + titanium body/ceramic body + ceramic back shell 2. Healthy GT4: Using the latest Huawei Truseen5.5+ algorithm, the results will be more accurate. GT3pro: Added ECG electrocardiogram and blood vessel and safety
