Së gi¸o dôc - ®µo t¹o QB §Ò chÝnh thøc Kú thi chän häc Sinh Giái líp 11 N¨m häc 2007-2008 híng dÉn chÊm m«n tin häc Dµnh cho häc sinh Chuyªn I/ Ph¬ng ph¸p chung - Gi¸m kh¶o t¹o c¸c bé d÷ liÖu vµo, tÝnh to¸n kÕt qu¶. Thùc hiÖn ch¬ng tr×nh cña häc sinh vµ so s¸nh kÕt qu¶. - Gi¸m kh¶o cã thÓ sö dông ch¬ng tr×nh mÉu ®Ó tÝnh kÕt qu¶ cña d÷ liÖu vµo: SUM.PAS; GIAIMA.PAS; TSP.PAS . - Ch¬ng tr×nh häc sinh ch¹y ®óng mçi bé test, gi¸m kh¶o cho 0.5 ®iÓm. Nh vËy, nÕu c©u hái cã 3 ®iÓm th× gi¸m kh¶o ph¶i t¹o ®îc 6 bé test. - NÕu ch¬ng tr×nh ch¹y sai test nµo th× gi¸m kh¶o cho 0 ®iÓm ®èi víi test ®ã. - Víi nh÷ng bµi cã nhiÒu kÕt qu¶, nÕu thÝ sinh ®a ra kÕt qu¶ kh¸c víi ®¸p ¸n nhng vÉn ®óng th× gi¸m kh¶o cho ®iÓm tèi ®a. - Riªng c©u 3: + Tæ chøc ®îc d÷ liÖu: 1 ®iÓm. + 2.5 ®iÓm cßn l¹i gi¸m kh¶o t¹o 5 bé test, mçi test ®óng cho 0.5 ®iÓm. II/ Ch¬ng tr×nh gîi ý C©u 1: (3 ®iÓm): Tæng c¸c ch÷ sè SUM.PAS Program Tong_cac_chu_so; Const fi='Sum.in4'; fo='Sum.out'; MaxN=1000; Type Arr=Array[1..MaxN] of Word; Var A:Arr; N,K:Word; Procedure Read_Data; Var i:Word; f:Text; Begin Assign(f,fi); Reset(f); Readln(f,N); For i:= 1 to N do Read(f,A[i]); Close(f); End; Function Sum(x:Word):Word; Var so:Word; Begin so:=0; While x0 do Begin So:=So + x mod 10; x:= x Div 10; end; Sum:=so; End; Procedure Write_Data; Var i:Word; f:Text; Begin Assign(f,fo); ReWrite(f); K:=0; For i:= 1 to N do if Sum(A[i]) mod 2 = 1 then inc(K); Writeln(f,K); For i:= 1 to N do if Sum(A[i]) mod 2 = 1 then Write(f,i,#32); Close(f); End; BEGIN Read_Data; Write_Data; END. C©u 2: (3.5 ®iÓm): Gi¶i m· Program Giai_ma; Const fi='Giaima.inp'; fo='Giaima.out'; A:array[1..8] of Byte = (128,64,32,16,8,4,2,1); Var sti,sto: string; Procedure Read_Data; Var f:text; Begin Assign(f,fi); Reset(f); Readln(f,sti); Close(f); End; Procedure Write_Data; Var f:text; Begin Assign(f,fo); ReWrite(f); Writeln(f,sto); Close(f); End; Function Gm(st1:string):Char; Var so,i:Byte; Begin so:=0; For i:=Length(st1) Downto 1 do If st1[i]= '1' then so:= so + A[i]; Gm:=Chr(so); End; Procedure Process; Var i:Byte; Begin sto:=''; i:=1; While i mm then mm:=b; if c>mm then mm:=c; Max:=mm; end; Procedure Processing; Var i,j:bb; Begin For j:=2 to n do Begin For i:=1 to m do QH[i,j]:=QH[i,j] + Max(QH[i-1,j-1],QH[i,j-1],QH[i+1,j-1]); QH[m+1,j]:=QH[1,j]; QH[0,j]:=QH[m,j]; End; end; (*****************) Procedure Write_Data; Var f:Text; i,Top,k,Row,col:bb;maxr:ll; Vet:mmc; Begin Assign(f,fo); ReWrite(f); maxr:=0; Row:=0; For i:=1 to m do if QH[i,n] > maxr then Begin maxr:=QH[i,n]; Row:=i; end; Writeln(f,maxr); FillChar(Vet,sizeof(Vet),0); Top:=1; Vet[Top]:=Row; Col := n; While Col > 1 do Begin k:=Row; For i:=k-1 to k+1 do if QH[i,Col-1]=Max(QH[Row-1,Col-1],QH[Row,Col-1],QH[Row+1,Col-1]) then Begin Row:=i; if Row = 0 then Row := m; if Row = m+1 then Row := 1; end; dec(Col); inc(Top); Vet[Top]:=Row; end; For i:=Top Downto 1 do Write(f,Vet[i],' '); Close(f); end; (*****************) Begin Init; Processing; Write_Data; end. (***************************************************************************)