¾ØÕóÁ¬³ËËã·¨javaʵÏÖ
public class MatrixChainOrder {
int[] p;
int[][] m;
int[][] s;
int length;
public MatrixChainOrder(int[] p,int[][] m,int[][] s){
this.p = p;
this.length = p.length/2;
this.m = m;
this.s = s;
init();
clac();
printM();
}
public void init(){
for (int i=0;i<length;i++){
m[i][i] = 0;
}
}
public void clac(){
for (int i=1;i<length;i++){
for (int j=0;j<length-i;j++){
int r = j+i;
int t = Integer.MAX_VALUE;
for (int k = j;k<r;k++){
int temp = m[j][k] + m[k+1][r] + p[j*2]*p[k*2+1]*p[r*2+1];
if (t > temp){
t = temp;
m[j][r] = temp;
}
}
}
}
}
public void printM(){
for (int i=0;i<length;i++){
for (int j=0;j<length;j++){
System.out.print(m[i][j]+ "\t");
}
System.out.println();
}
}
public static void main(String args[]){
int p[] = {30,35,35,15,15,5,5,10,10,20,20,25};
int length = 6;
int[][] m = new int[6][6];
int[][] s = new int[6][6];
new MatrixChainOrder(p,m,s);
}
}
³ÌÐòÔËÐеĽá¹ûÊÇ:
0 15750 7875 9375 11875 15125
0 0 2625 4375 7125 10500
0 0 0 750 2500 5375
0 0 0
Ïà¹ØÎĵµ£º
×Ô¼ºÊÕ¼¯µÄһЩjava´¦ÀíÀ࣬¹©ÒÔºó²éѯ
package com.tools;
import java.text.SimpleDateFormat;
import java.util.Date;
public class StringHandler {
/******************************
* ¹¦ÄÜ£º½«IPµØÖ·×ª»»Îª¶ÔÓ¦µÄÕûÊý
* ·µ»ØÀàÐÍ£ºlong
******************************/
public static long getI ......
ÕâÀï¶ÔÓÚ¼¸¸ö»ù±¾µÄ¸ÅÄî URL TCP UDP Socket ¾Í²»¼Ó˵Ã÷ÁË£¬ÕâÀï½ö½öÊǼǼһЩѧϰÈÕÖ¾±¸Íü¡£
1£ºÈçºÎ¶¨ÒåÏà¶Ô×ÊÔ´
¼ÙÉèÓÐÈçÏÂÁ½¸ö×ÊÔ´ £º
http://www.gamelan.com/pages/Gamelan.game.html
http://www.gamelan.com/pa ......
¡¶javaÓïÑÔ³ÌÐòÉè¼Æ£¨Ò»£©¡·2009Äê×Ôѧ¿¼ÊÔ´ó¸ÙµÚ3ÕÂ
www.wesiedu.com 2009-5-5 ÔÚÏßÄ£Ä⿼³¡
µÚ3ÕÂ ÃæÏò¶ÔÏó±à³Ì»ù´¡
(Ò»)¿Î³ÌÄÚÈÝ
3.1 ÃæÏò¶ÔÏóµÄ»ù±¾¸ÅÄî
3.2 JavaµÄÀàºÍ¶ÔÏó
3.2.1 Àà
3.2.2¶ÔÏó
3.2.3ʵÀý±äÁ¿ºÍÀà±äÁ¿
3.2.4ʵÀý·½·¨ºÍÀà·½·¨
3.2.5·ÃÎÊȨÏÞ
3.2.6¼Ì³Ð
3.2.7 Java ......
¡¶javaÓïÑÔ³ÌÐòÉè¼Æ£¨Ò»£©¡·2009Äê×Ôѧ¿¼ÊÔ´ó¸ÙµÚ6ÕÂ
www.wesiedu.com 2009-5-5 ÔÚÏßÄ£Ä⿼³¡
µÚ6Õ ͼÐνçÃæÉè¼Æ(¶þ)
(Ò»)¿Î³ÌÄÚÈÝ
6.1Ñ¡Ôñ¿òºÍµ¥Ñ¡°´Å¥
6.1.1Ñ¡Ôñ¿ò
6.1.2µ¥Ñ¡¿ò
6.1.3µ¥Ñ¡°´Å¥
6.1.4Ñ¡ÔñÏîĿʼþ´¦Àí
6.2ÁбíºÍ×éºÏ¿ò
6.2.1Áбí
6.2.2×éºÏ¿ò
6.3²Ëµ¥
6.3.1²Ëµ¥Ìõ¡ ......
¡¶javaÓïÑÔ³ÌÐòÉè¼Æ£¨Ò»£©¡·2009Äê×Ôѧ¿¼ÊÔ´ó¸ÙµÚ7ÕÂ
www.wesiedu.com 2009-5-5 ÔÚÏßÄ£Ä⿼³¡
µÚ7Õ ͼÐΡ¢Í¼ÏñÓë¶àýÌå
(Ò»)¿Î³ÌÄÚÈÝ
7.1 »æÍ¼»ù´¡
7.1.1 GraphicsÀàµÄ»ù±¾¹¦ÄÜ
7.1.2×ÖÐͺÍÑÕÉ«
7.1.3»æÍ¼Ä£Ê½
7.2»æÍ¼
7.2.1 GâîphicsÀàµÄ»æÍ¼·½·¨
7.2.2 Gmphics2DÀàµÄ»æÍ¼·½·¨
7.3ͼ ......