動腦數學題
A JU
個人資料 | email
posted 05-27-99 9:59 AM PT (US)
請將下列1到9的數字中間以加、減、乘、除四種
符號填入,使結果等於100.(有三種答案)

1( )2( )3( )4( )5( )6( )7( )8( )9=100

Xiren
個人資料 | email
posted 05-27-99 11:41 AM PT (US)
1. 1+2+3-4x5+6x7+8x9=100
2. 1+2x3x4x5/6+7+8x9=100
3. 1x2x3+4+5+6+7+8x9=100

I don't have to use all 4 operators in one equation, do I?

Xiren
個人資料 | email
posted 05-27-99 6:19 PM PT (US)
It appeared to me that it's not possible to use all 4 operators in the same equation -- if the division sign (/) is used, [2] would be the only answer. Also, there are more than 3 answers since: 1+2+3 = 1x2x3 = 6.
So [1] and [3] can be turned into:

4. 1x2x3-4x5+6x7+8x9=100
5. 1+2+3+4+5+6+7+8x9=100

and here is another one:

6. 1-2+3x4x5+6x7+8-9=100

A JU
個人資料 | email
posted 05-29-99 1:40 AM PT (US)
昔人:
既然說三種答案,應該是四種都要用上.答案我還不
知道.好吧!我招了,這是我們公司刊物上的題目,可
以抽獎的^_^
如果有抽到獎品的話,再分給你~~~~看.^O^
CC
個人資料 | email
posted 05-29-99 4:08 AM PT (US)
以下是高連用一小巨集程式得出的結果﹐由此
可見不可能盡用+-×÷﹕
1+2+3+4+5+6+7+8*9
1+2+3-4*5+6*7+8*9
1+2-3*4+5*6+7+8*9
1+2-3*4-5+6*7+8*9
1+2*3+4*5-6+7+8*9
1+2*3*4*5/6+7+8*9
1-2+3*4*5+6*7+8-9
1-2+3*4*5-6+7*8-9
1-2*3+4*5+6+7+8*9
1-2*3-4+5*6+7+8*9
1-2*3-4-5+6*7+8*9
1*2*3+4+5+6+7+8*9
1*2*3-4*5+6*7+8*9
1*2*3*4+5+6+7*8+9
1*2*3*4+5+6-7+8*9
(共十五種)。

Excel macro:
Sub test100()
Dim s(4)
s(1) = "+"
s(2) = "-"
s(3) = "*"
s(4) = "/"

For i1 = 1 To 4
For i2 = 1 To 4
For i3 = 1 To 4
For i4 = 1 To 4
For i5 = 1 To 4
For i6 = 1 To 4
For i7 = 1 To 4
For i8 = 1 To 4
a = 1 & s(i1) & 2 & s(i2) & 3 & s(i3) & 4 & s(i4) & 5 & s(i5) & 6 & s(i6) & 7 & s(i7) & 8 & s(i8) & 9
If (Evaluate(a) = 100) Then
ActiveCell.FormulaR1C1 = a
ActiveCell.Offset(1, 0).Range("A1").Select
End If
Next i8
Next i7
Next i6
Next i5
Next i4
Next i3
Next i2
Next i1
End Sub

A JU
個人資料 | email
posted 05-29-99 5:29 AM PT (US)
謝謝高連及昔人!
我想,也只有用巨集程式算才比較完整.可惜我不會
程式語言.
但不知昔人是不是用人腦算的?

那麼只有一種解答能四種符號全用上了.

CC
個人資料 | email
posted 05-29-99 6:35 AM PT (US)
那麼只有一種解答能四種符號全用上了.
???
Xiren
個人資料 | email
posted 05-29-99 9:06 AM PT (US)
但不知昔人是不是用人腦算的?
是。若用程式還得不到完整答案,我也太不濟了吧。^_^

這題還算有趣,因為若先不考慮結果,共有 4**8=65536
種組合,然而許多一想便知是不可能的,以÷為例
,不可能放在5、7、9 之前,而且一旦用了÷,在
遇到公因數(common factor)或最小公倍數(LCD)
可將它「消化」之前,只能用乘(x)。因此,只要花
一點時間,將÷分別代入其他 5 個位置一算,就知
無法在同一式子中,將四個符號都用上。

Xiren
個人資料 | email
posted 05-29-99 10:13 PM PT (US)
我也用 JScript 寫了一個程式來玩,欲執行請按這裡
(Source Code 用 IE 的 View Source 才看得見, Netscape 不行,
因此將 Script 貼在此,供有興趣的朋友參考)

<SCRIPT LANGUAGE = "JavaScript">
var op = new Array('+', '-', '*', '/');
function test100(num, expr) {
var str="";
var i=0;

for (; i<4; i++) {
str = expr + op[i] + num;
if (num < 9)
test100(num+1, str);
else {
if (eval(str) == 100)
document.writeln(str);
}
}
}

test100(2, "1");
</SCRIPT>

A JU
個人資料 | email
posted 05-30-99 10:37 AM PT (US)
高連:
是我眼花沒看清,昔人之前也說了,好像沒有
一種答案可以四種都用上的.
A JU
個人資料 | email
posted 06-04-99 9:36 AM PT (US)
真是對不起昔人及高連因為....
題目我漏看了幾個字...所以結果大不相同.

正確題目應該是:

請將下列1到9的數字中間以加、減、乘、除四種
符號及適當的括號填入,使結果等於100.(有三種
答案)
1( )2( )3( )4( )5( )6( )7( )8( )9=100

Xiren
個人資料 | email
posted 06-04-99 5:07 PM PT (US)
If parentheses are allowed, there would be far more than 3 answers. Just to list a few:

1+(2+3+(4+5)/6+7)*8-9
1+(2+3-(4*5-6)/7+8)*9
1+(2+(3-4*5)/(6-7)-8)*9
1+(2+(3-4)/5)*(6*7+8)+9
1+(2+3*(4+5)/6+7)*8-9
1+(2+3*4*5/6+7-8)*9
1+(2+3*4-5/(6-7)-8)*9
1+(2+3*4*(5-6+7)/8)*9
1+(2+3*4*5/6+7-8)*9
1+(2+3+(4+5)/6+7)*8-9
1+(2+3+4)*5-6/(7-8)*9
1+(2+3-(4*5-6)/7+8)*9
1+(2+3-4*5)*6/(7-8)+9
1+(2+3*4+5/6+7)*8-9
1+(2+3*4*5/6+7-8)*9
1+(2+3*4-5/(6-7)-8)*9
1+(2+3*4*(5-6+7)/8)*9
1+(2+3*4*5/6+7-8)*9

To run the program, please click HERE.
Warning: the result will take a long time to complete, and this program only works with the Internet Explorer.

A JU
個人資料 | email
posted 06-05-99 3:47 AM PT (US)
謝了~~X

楊過的傷心小站 | 過兒的討論區 | 討論精華
寫信給過兒 | 超級無敵IQ題 | 超級無敵IQ題精華討論主頁