Kỳ thi lập đội tuyển học sinh giỏi quốc gia năm học 2013-2014 môn : tin học 12 - trung học phổ thông
Bạn đang xem nội dung tài liệu Kỳ thi lập đội tuyển học sinh giỏi quốc gia năm học 2013-2014 môn : tin học 12 - trung học phổ thông, để tải tài liệu về máy bạn click vào nút DOWNLOAD ở trên
SỞ GIÁO DỤC & ĐÀO TẠO KỲ THI LẬP ĐỘI TUYỂN HSG QUỐC GIA
NĂM HỌC 2013-2014
ĐẮK LẮK MÔN : TIN HỌC 12 - THPT
ĐÁP ÁN VÀ HƯỚNG DẪN CHẤM VÒNG 1
I. Phần chương trình nguồn
BÀI 1 –TỪ ĐỐI XỨNG
var f,g:text;st:string;
Function tudao(st:string):string;
Var i:integer;st1:string;
Begin
st1:='';
For i:=length(st) downto 1 do
st1:=st1+st[i];
tudao:=st1;
End;
Function demtudx(st:string):integer;
Var dem:integer;tu,tu1:string;
Begin
dem:=0;
st:=st+' ';
While length(st)>1 do
Begin
While st[1]=' ' do
delete(st,1,1);
tu:=copy(st,1,pos(' ',st));
if st'' then
st:=' '+st;
tu:=' '+tu;
While pos(tu,st)>0 do
delete(st,pos(tu,st),length(tu)-1);
tu1:=tudao(tu);
If (pos(tu1,st)>0) and (st[pos(tu1,st)+length(tu1)-1]=' ') then
inc(dem);
demtudx:=dem;
End;
end;
procedure xuly;
Var st:string;
Begin
Assign(f,'bai1.inp');
Reset(f);
Assign(g,'bai1.out');
Rewrite(g);
While not eof(f) do
Begin
Readln(f,st);
Writeln(g,demtudx(st));
End;
Close(f);
Close(g);
End;
Begin
xuly;
End.
BÀI 2 – Biểu thức zero
Program Zero_sum;
Type MangStr = array[1..15] of string;
Const Fi ='BAI2.INP';
Fo ='BAI2.OUT';
Dau : array[1..3] of string[1] = ('-','+','');
S : array[1..9] of char =('1','2','3','4','5','6','7','8','9');
ChuSo = ['1'..'9'];
Var N,k,dem: byte;
D : array[2..9] of string[1];
F : Text;
St : String;
M : MangStr;
Procedure Write_out;
Var i : byte;
Begin
Assign(F,Fo); Rewrite(F);
Writeln(F,dem);
For i:= 1 to dem do writeln(F,M[i],' = 0');
Close(F); Halt;
End;
Procedure Read_inp;
Begin
Assign(F,Fi); Reset(F);
Read(F,N); Close(F);
If N < 3 then write_out;
End;
Function DocSo(S : String): longint;
Var M : longint;
t : byte;
Begin
M:= 0; t:= 0;
If S[k] in ['+','-'] then
begin
t:= k; Inc(k);
end;
While (k<= length(S)) and (s[k] in ChuSo) do
begin
m:= m*10 + ord(s[k]) - ord('0');
Inc(k);
end;
If (t 0) and (S[t] = '-') then DocSo:= -M
else DocSo:= M;
End;
Procedure Test;
Var St : string;
i : byte;
T : longint;
Begin
St:= '1'; k:= 1; T:= 0;
For i:= 2 to N do St:= St + D[i] + S[i];
While k < length(St) + 1 do T:= T + DocSo(St);
If T = 0 then
begin
Inc(dem); M[dem]:= St;
end;
End;
Procedure Try(i: byte);
Var j : byte;
Begin
For j:= 1 to 3 do
begin
D[i]:= Dau[j];
If i = N then Test else try(i+1);
end;
End;
BEGIN
Read_inp;
Try(2);
Write_out;
END.
BÀI 3 – TAM GIÁC SỐ
{ QUY HOẠCH ĐỘNG}
Program bai3;
Uses crt;
Type mang = array[1..100,1..100] of integer;
Var
f:text;
i,j,n:integer;
a,b:mang;
Procedure Input;
Begin
clrscr;
Assign(f,'bai3.inp');
reset(f);
readln(f,n);
for j:=1 to n do
begin
for i:=2 to j+1 do
read(f,a[j,i]);
end;
close(f);
end;
{----------------------------------}
Function Max(m,n:integer):integer;
Begin
if n>m then Max:=n
else Max:=m;
end;
{----------------------------------}
Procedure MakeArrayOfQHD;
Begin
b[1,2]:=a[1,2];
for j:=1 to n do b[j,1]:=-maxint;
for i:=3 to n do b[1,i]:=-maxint;
for j:=2 to n do
begin
for i:=2 to j+1 do
b[j,i]:=a[j,i]+max(b[j-1,i],b[j-1,i-1]);
end;
end;
{-----------------------------------}
Procedure FindMax;
var max:integer;
Begin
max:=b[n,1];
for i:=2 to n do
if b[n,i]>max then max:=b[n,i];
assign(f,'bai3.out');rewrite(f);
write(f,max);
close(f);
end;
{------------------------------------}
BEGIN
Input;
makearrayofQHD;
FindMax;
END.
II. Hướng dẫn chấm.
Bài 1: 3 Test, mỗi test đúng cho 2 điểm.
Bài 2: 3 Test, mỗi test đúng cho 2 điểm + 1 điểm test mẫu ví dụ.
Bài 3: 3 Test, mỗi test đúng cho 2 điểm + 1 điểm test mẫu ví dụ
Chú ý: Kết quả có thể có nhiều phương án khác nhau do đó yêu cầu giám khảo xem xét kỹ khi chấm bài.
---- Hết ----
File đính kèm:
dap an chon doi tuyen hsg tin 2013 V1.doc



