Topic: 数学问题-排列组合的实际应用

  Print this page

1.数学问题-排列组合的实际应用 Copy to clipboard
Posted by: focus
Posted on: 2008-03-28 14:54

我是来求答案的, 自己还没想好怎么算!

(缩略图,点击图片链接看原图)

2.Re:数学问题-排列组合的实际应用 [Re: focus] Copy to clipboard
Posted by: focus
Posted on: 2008-03-28 15:17

No one knows? very urgent

3.Re:数学问题-排列组合的实际应用 [Re: focus] Copy to clipboard
Posted by: JiafanZhou
Posted on: 2008-03-28 17:25

Can you explain why it is 4*4*4*4*3*3 = 2304 ? Is it not to be 3*3*3*3*2*2=324 i.e. 324 different selection?

4.Re:数学问题-排列组合的实际应用 [Re: focus] Copy to clipboard
Posted by: focus
Posted on: 2008-03-29 13:55

因为可以不选呀. 不选也是一种选择.
所以是 4*4*4*4*3*3 = 2304

5.Re:数学问题-排列组合的实际应用 [Re: focus] Copy to clipboard
Posted by: flyingwalf
Posted on: 2008-03-31 12:37

个人理解:这个问题的本质是,每一行不选和选1,对于乘积的结果是没有影响的,所以乘积结果取决于你选了多少个3和多少个9,同时注意到3和9的关系,选了一个9也就相当于选了两个三,也就是最终乘积的不同结果的个数取决于能够选到多少个3,能选到多少个2,也就是有多少个不同的结果,那就是看个最值
设有x个3和y个9,显然是当x=0,y=6的时候可以取到最大,也就是说最多可以选到6*2=12个3,这12个值每个都能取道,所以,最终结果是original score共有12种值

6.Re:数学问题-排列组合的实际应用 [Re: focus] Copy to clipboard
Posted by: flyingwalf
Posted on: 2008-03-31 12:39

更正:上面回复中 “能选到多少个2” 为误输入,应为“能选到多少个9”

7.Re:数学问题-排列组合的实际应用 [Re: focus] Copy to clipboard
Posted by: focus
Posted on: 2008-03-31 13:42

楼上的说到点子上去了,,但实际上是 14种值,,你忘记加上 1 和 0 了.
我用程序"暴力"破解的结果是这样的:

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
* @author Xujin.Jiao
*
*/
public class Caculate {
private static final int[] pf = {0, 1, 3, 9};
private static final int[] cost = {0, 1, 3, 9};
private static final int[] ofDay = {0, 1, 3, 9};
private static final int[] impact = {0, 1, 3, 9};
private static final int[] sr = {0, 1, 9};
private static final int[] bd = {0, 1, 9};

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int totalSels = 0;
int value = 0;
List<Integer> valueList = new ArrayList<Integer>();

totalSels = pf.length * cost.length * ofDay.length *
impact.length * sr.length * bd.length;

for (int i = 0; i < pf.length; i++) {
for (int j = 0; j < cost.length; j++) {
for (int k = 0; k < ofDay.length; k++) {
for (int l = 0; l < impact.length; l++) {
for (int m = 0; m < sr.length; m++) {
for (int n = 0; n < bd.length; n++) {
value = (0 == pf[i] ? 1 : pf[i]) * (0 == cost[j] ? 1 : cost[j]) * (0 == ofDay[k] ? 1 : ofDay[k]) *
(0 == impact[l] ? 1 : impact[l]) * (0 == sr[m] ? 1 : sr[m]) * (0 == bd[n] ? 1 : bd[n]);
if (0 == pf[i] && 0 == cost[j] && 0 == ofDay[k] &&
0 == impact[l] && 0 == sr[m] && 0 == bd[n]) {
value = 0;
}
if (!valueList.contains(new Integer(value))) {
valueList.add(new Integer(value));
}
}
}
}
}
}
}

System.out.println("There are " + totalSels + " different selections.");
System.out.println("There are " + valueList.size() + " different values.");

System.out.println("These values are listed below:");
Collections.sort(valueList);
for (int i = 0; i < valueList.size(); i++) {
System.out.println(valueList.getLight Bulb.toString());
}
}

}




There are 2304 different selections.
There are 14 different values.
These values are listed below:
0
1
3
9
27
81
243
729
2187
6561
19683
59049
177147
531441

8.Re:数学问题-排列组合的实际应用 [Re: focus] Copy to clipboard
Posted by: flyingwalf
Posted on: 2008-03-31 14:15

嗯,确实,我总是这么粗心,呵呵
其实y的取值是0——6,所以是7种,结果应该是7*2=14种

9.Re:数学问题-排列组合的实际应用 [Re: focus] Copy to clipboard
Posted by: JiafanZhou
Posted on: 2008-03-31 16:04

问题分析的很不错,程序有没有可能改进?这么多for影响性能。


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923