vj1100 &aring;Š&nbsp;&aring;ˆ†&auml;&ordm;Œ&aring;‰&aelig;&nbsp;‘

# Vj1100 &aring;Š&nbsp;&aring;ˆ†&auml;&ordm;Œ&aring;‰&aelig;&nbsp;‘

This preview shows pages 1–2. Sign up to view the full content.

//±ÉÈËµÄ·½·¨ //dp //Éè f[i,j] ±íÊ¾ÖÐÐò±éÀú´Ó i µ½ j µÄ×î´ó¼Ó·Ö Í¨¹ýÃ¶¾Ù¸ù½Úµã¼ÆËã //f[ i , j ] = max( f[ i , k-1 ]*f[ k+1 , j ] + score[ k ]) (i<=k<=j) ³õÖµ f[i,i-1]=1 f[i+1,i]=1 (1<=i<=n) //µÚ¶þÎÊ¼ÇÂ¼ root[ i , j ] ±íÊ¾ i µ½ j ×î´ó¼Ó·ÖµÄ¸ù½Úµã µÝ¹éÊä³ö / const maxn=30; var n:integer; score:array[0. .maxn] of integer; f:array[0. .maxn,0. .maxn] of longword; root:array[0. .maxn,0. .maxn] of integer; procedure init; var i:integer; begin readln(n); for i:=1 to n do read(score[i]); end; procedure main; var i,j,k,l:integer; tmp:longword; begin for i:=1 to n do f[i,i-1]:=1;

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## Vj1100 &aring;Š&nbsp;&aring;ˆ†&auml;&ordm;Œ&aring;‰&aelig;&nbsp;‘

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online