vj1455 &aelig;œ€&aring;&deg;&auml;&cedil;Ž&aelig;œ€&aring;&curren;&sect;

# Vj1455 æœ€å°ä¸Žæœ€å¤§

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

//±ÉÈËµÄ·½·¨ //dp //(a+b) mod c =( ( a mod c ) + ( b mod c ) ) mod c //Éè f[ i , t ] ÎªÇ° i ¸öÊý×Ö mod m = t ÐèÒªµÄ×îÐ¡³ËºÅ //Éè md [ i , j ] Îª´Ó i µ½ j mod m µÄÖµ md [ i , j ] = ( md [ i , j-1 ] * 10 + a[ j ] ) mod m //f[ i , t ] = min ( f[ k , j ] ) + 1 ( k < i ) //ÆäÖÐ f[ k , j ] * md [ k+1 , i ] mod m = t / const maxm=50; maxn=1000; var n,m:integer; a:array[0. .maxn] of integer; f:array[0. .maxn,0. .maxm-1] of integer; md:array[0. .maxn,0. .maxn] of integer; procedure init; var i:integer; ch:char; begin while not eoln do begin read(ch); inc(n); a[n]:=ord(ch)-48; end; readln; readln(m); end; procedure main; var i,j,k,t:integer; begin for i:=1 to n do for j:=i to n do md[i,j]:=(md[i,j-1]*10+a[j]) mod m; for i:=1 to n do

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

Vj1455 æœ€å°ä¸Žæœ€å¤§

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

View Full Document
Ask a homework question - tutors are online