13872434240
級(jí)別: 正式會(huì)員
精華主題: 0
發(fā)帖數(shù)量: 34 個(gè)
工控威望: 85 點(diǎn)
下載積分: 800 分
在線時(shí)間: 35(小時(shí))
注冊(cè)時(shí)間: 2018-12-12
最后登錄: 2024-10-12
查看13872434240的 主題 / 回貼
樓主  發(fā)表于: 2022-05-23 10:59
1到9這9個(gè)數(shù),滿足3位數(shù)+3位數(shù) = 3位數(shù) ,每個(gè)數(shù)字只能用一次,求解????
yuanbubble
級(jí)別: 略有小成
精華主題: 0
發(fā)帖數(shù)量: 155 個(gè)
工控威望: 303 點(diǎn)
下載積分: 250 分
在線時(shí)間: 250(小時(shí))
注冊(cè)時(shí)間: 2019-05-27
最后登錄: 2024-12-25
查看yuanbubble的 主題 / 回貼
1樓  發(fā)表于: 2023-11-29 11:55
先判斷加數(shù)和被加數(shù)無(wú)相等再去做加法,然后也是拆分成3位,用或運(yùn)算做的,沒(méi)用for循環(huán),查到也可以填充到數(shù)組,利用數(shù)組的屬性去做元素重復(fù)判斷,但是沒(méi)用過(guò),就用笨一點(diǎn)的辦法。最終數(shù)量不確定是不是包含最后一個(gè)空格,只是一個(gè)控件的行數(shù)。
                            bool b11 = (a == 0 | a == b | a == c | a == l | a == m | a == n | a == x | a == y | a == z);
                            bool b12 = (b == 0 | b == c | b == l | b == m | b == n | b == x | b == y | b == z);
                            bool b13 = (c == 0 | c == l | c == m | c == n | c == x | c == y | c == z);
                            bool b14 = (l == 0 | l == m | l == n | l == x | l == y | l == z);
                            bool b15 = (m == 0 | m == n | m == x | m == y | m == z);
                            bool b16 = (n == 0 | n == x | n == y | n == z);
                            bool b17 = (x == 0 | x == y | x == z);
                            bool b18 = (y == 0 | y == z);
                            bool b19 = (z == 0);
                            if (b11 | b12 | b13 | b14 | b15 | b16 | b17 | b18 | b19)
                            {

                            }
                            else
                            {
                                count = i.ToString() + "+" + j.ToString() + "=" + sum.ToString();
                                textBox1.AppendText(count + "\r\n");

                            }
附件: 1-9-3位數(shù)+三位數(shù)=3位數(shù)--要求不重復(fù).rar (315 K) 下載次數(shù):7
網(wǎng)站提示: 請(qǐng)不要用迅雷下載附件,容易出錯(cuò)