vj1144 &aring;&deg;&egrave;ƒ–&aring;&reg;ˆ&ccedil;š‡&aring;&reg;&laquo;

# Vj1144 å°èƒ–å®ˆçš‡å®«

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

//±ÉÈËµÄ·½·¨ //Ê÷ÐÍdp //×¢Òâ·ÖÀà //Ã¿¸ö½áµã¿´ÊØÇé¿öÓÐÈý£º¸¸½áµã ×Ô¼º ×Ó½áµã Éè·Ö±ðÎª f[i,0] f[i,1] f[i,2] //f[i,0]=sum( min( f[j,1] , f[j,2] ) ) //f[i,1]=sum( min( f[j,0] , f[j,1] ,f[j,2] ) ) + cost[i] //f[i,2]=sum( min( f[j,1] , f[j,2] ) ) + min( f[k,1] - min( f[k,1] , f[k,2] ) ) ×Ó½áµãÖÐ±ØÐëµÃ·ÅÒ»¸ö //ans=min( f[root,1] , f[root,2] ) / const maxn=1500; var n,root:integer; cost,total:array[0. .maxn] of integer; f:array[0. .maxn,0. .2] of longint; son:array[0. .maxn,0. .maxn] of integer; v:array[0. .maxn] of boolean; function min(x,y:longint):longint; begin if x<=y then exit(x); exit(y); end; procedure init; var i,j,x:integer; begin readln(n); for i:=1 to n do begin read(x); read(cost[x]); read(total[x]);

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.

## This note was uploaded on 02/21/2011 for the course CS 001 taught by Professor 001 during the Spring '11 term at Shandong University.

### Page1 / 2

Vj1144 å°èƒ–å®ˆçš‡å®«

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

View Full Document
Ask a homework question - tutors are online