HDC đề thi học sinh giỏi môn tin ninh bình 2015 2016 đề vòng 1 ngày 1

6 723 8
HDC   đề thi học sinh giỏi môn tin   ninh bình   2015   2016   đề vòng 1   ngày 1

Đang tải... (xem toàn văn)

Thông tin tài liệu

Tuyển tập bộ đề thi học sinh giỏi các tỉnh trong các năm học vừa qua. Đề thi học sinh giỏi môn toán tỉnh Ninh Bình năm học 20152016. Đề đã được kiểm tra và đánh giá. Đề luôn đảm bảo chất lượng và nội dung.

SỞ GD&ĐT NINH BÌNH HDC ĐỀ THI CHỌN HSG LỚP THPT Kỳ thi thứ - Năm học 2015 – 2016 MÔN: TIN HỌC Ngày thi 06/10/2014 (hướng dẫn chấm gồm 06 trang) Câu Code Program Nttd; const fi='nttd.inp'; fo='nttd.out'; Var M,N,d,i,dem: longint; f,g: text; điểm { } Function USCLN(m,n: longint): longint; Var r: longint; Begin While n0 begin r:=m mod n; m:=n; n:=r; end; USCLN:=m; End; { } BEGIN dem:=0; assign(f,fi); reset(f); assign(g,fo); rewrite(g); read(f,M,N); d:= USCLN(M,N); i:=2; While d1 begin If d mod i = then begin dem := dem + 1; While d mod i= d:=d div i; While M mod i = M:=M div i; While N mod i = N:=N div i; end; Inc(i); end; if M * N = then write(g,dem) else write(g,0); close(f); close(g); END const fi= 'CATGO.inp'; fo= 'CATGO.out'; var a:array[1 20] of longint; //gia tri cua cac so T:array[1 21] of longint; // tong cac gia tri nhom x:array[1 20] of longint; // vector nghiem n,k: longint; curent: longint; // so lon nhat hien tai da su dung // vector nghiem f,f2:text; ketqua : boolean; { } procedure nhap; var i: longint; begin assign(f,fi); reset(f); readln(f,n,k); for i:=1 to n read(f,a[i]); close(f); end; { -} function kt:boolean; var i: longint; begin for i:=1 to K-1 if t[i]t[i+1] then exit(false); exit(true); end; { } procedure inkq; var i,j: longint; begin assign(f,fo); rewrite(f); for i:=1 to k begin for j:=1 to n if x[j]=i then write(f,a[j],' ' ); writeln(f); end; close(f); close(f2); halt; end; { } procedure backtrack(i:longint); var j: longint; begin //neu i la vi tri gioi han cuoi cung cua curen+1 //thi gan vi tri i cho curent+1 if (i= n-k+curent+1) and (curent curen+1 else begin for j:=1 to curent+1 begin if j>K then exit; // neu j da lon hon K thi x[i] khong nhan if j=curent+1 then // neu x[i] nhan gia tri curen+1 begin // thi phai tang curent hien tai len don vi x[i]:=j ;inc(curent); t[j]:= t[j]+a[i]; if i= n then begin if kt then ketqua := true ; end else backtrack(i+1); t[j]:=t[j]-a[i]; dec(curent); end else // neu khong thi khong tang gia tri curent begin x[i]:=j ; t[j]:= t[j]+a[i]; if i= n then begin if kt then ketqua := true ; end else backtrack(i+1); t[j]:=t[j]-a[i]; end; end; end; end; { } Procedure sx; Var i,j: longint; Tg:longint; Begin ketqua := false; For i:=1 to n-1 For j:=i+1 to n if a[i]>a[j] then begin tg:= a[i]; a[i]:=a[j]; a[j]:=tg; end; End; begin nhap; sx; curent:=0; backtrack(1); assign(f,fo); rewrite(f); if ketqua then writeln(f,'1') else write(f, 0); close(f); end điểm program SCLN; uses crt; const maxn = 251; fi = 'SCLN.INP'; fo = 'SCLN.OUT'; var pa : array[0 maxn,0 maxn] of byte; s1,s2,skq : string; max : byte; {============================================} procedure docf; var f : text; begin assign(f,fi); reset(f); readln(f,s1); read(f,s2); close(f); end; function maxso(a,b:byte) : byte; begin maxso := (abs(a-b)+a+b) div 2; end; {============================================} procedure Idonotknow; var i,j : byte; begin for i := length(s1) downto for j := length(s2) downto if s1[i] = s2[j] then pa[i,j] := pa[i+1,j+1] +1 else pa[i,j] := maxso(pa[i+1,j] , pa[i,j+1] ); max := pa[1,1]; end; {============================================} procedure wastingtime; var ch : char; i,j,so,is,js : byte; begin is := 1; js := 1; so := 0; repeat for ch := '9' downto '0' begin i := is; j := js; while (s1[i] ch)and(i

Ngày đăng: 27/09/2016, 20:06

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan