intTypePromotion=1
zunia.vn Tuyển sinh 2024 dành cho Gen-Z zunia.vn zunia.vn
ADSENSE

Kỳ thi chọn HSG Tin học 12 (2010-2011) - GD&ĐT tỉnh Yên Bái (Kèm Đ.án)

Chia sẻ: Van Nhu Loan | Ngày: | Loại File: PDF | Số trang:6

274
lượt xem
42
download
 
  Download Vui lòng tải xuống để xem tài liệu đầy đủ

Với đề thi chọn học sinh giỏi môn Tin học lớp 12 năm 2010-2011 của Sở Giáo dục và Đào tạo tỉnh Yên Bái sẽ giúp các bạn học sinh chuẩn bị ôn luyện và bổ trợ kiến thức cho kỳ thi học sinh giỏi sắp tới cũng như phát huy tư duy, năng khiếu về môn Tin học. Mời các bạn tham khảo.

Chủ đề:
Lưu

Nội dung Text: Kỳ thi chọn HSG Tin học 12 (2010-2011) - GD&ĐT tỉnh Yên Bái (Kèm Đ.án)

  1. SỞ GIÁO DỤC VÀ ĐÀO TẠO KỲ THI CHỌN HỌC SINH GIỎI TỈNH YÊN BÁI LỚP 12 THPT NĂM HỌC 2010- 2011 Môn thi: Tin học Thời gian: 180 phút (không kể thời gian giao đề) Ngày thi: 10-10-2010 Bài 1(6 điểm): Cho một số tự nhiên N (1
  2. Bài 3 (7 điểm): Tại quốc gia T đã có n (n
  3. ĐÁP ÁN: Đề thi chính thức Môn: Tin học lớp 12 Bài 1: (6 điểm) program bt1; const fi='d:\bt1.txt'; fo='d:\bt1.out'; var a:array[1..120,0..120] of longint; n:byte; procedure input; var f:text; begin assign(f,fi); reset(f); readln(f,n); close(f); end; procedure pt; var i,j,t:byte; begin for i:=1 to n do for j:=1 to n do a[i,j]:=0; for i:=1 to n do a[i,0]:=1; for i:=1 to n do for j:=1 to n do if j
  4. f:text; i,j,n,x,y,m,s,dmin:word; tg,min:longint; procedure nhap; begin assign(f,fi); reset(f); readln(f,n,s); for i:=1 to n do for j:=1 to n do a[i,j]:=vc; for i:=1 to n do a[i,i]:=0; while not(seekeof(f)) do begin readln(f,x,y,m); a[x,y]:=m; a[y,x]:=m; end; close(f); end; procedure dijstra; begin fillchar(dd,sizeof(dd),0);dd[s]:=1;t[s]:=s;d[s]:=0; for i:=1 to n do if is then begin d[i]:=a[s,i];t[i]:=s; end; repeat min:=VC; for i:=1 to n do if (dd[i]=0) and (d[i]d[dmin]+a[dmin,i] then begin d[i]:=d[dmin]+a[dmin,i];t[i]:=dmin; end; end; until min=vc; end; procedure vietkq; begin assign(f,fo);rewrite(f); tg:=0; for i:=1 to n do if is then tg:=tg+a[i,t[i]]; writeln(f,tg); close(f); end; begin 4
  5. nhap; dijstra; vietkq; end. Bài 3: (7 điểm) program bt3; const fi='d:\pd.txt'; fo='d:\pd.out'; type diem=record x,y:integer; end; mdiem=array[1..100] of diem; var a,b:mdiem; c:array[0..100,0..100] of integer; n:byte; procedure docfile; var f:text; i:integer; t1,t2:integer; begin assign(f,fi); reset (f); readln(f,n); for i:=1 to n do begin readln(f,t1,t2); a[i].x:=t1; b[i].x:=t2; a[i].y:=i; b[i].y:=i; end; close(f); end; procedure sapxep(var d:mdiem); var tam:diem; i,j:byte; begin for i:=1 to n-1 do for j:=i+1 to n do if d[i].x>d[j].x then begin tam:=d[i]; d[i]:=d[j]; d[j]:=tam; end; end; function max(a,b:integer):integer; begin if a>b then max:=a else max:=b; end; 5
  6. procedure xuli; var i,j:byte; begin sapxep(a); sapxep(b); for i:=0 to n do begin c[i,0]:=0; c[0,i]:=0; end; for i:=1 to n do for j:=1 to n do if a[i].y=b[j].y then c[i,j]:=max(c[i-1,j],c[i,j-1])+1 else c[i,j]:=max(c[i-1,j],c[i,j-1]); end; procedure ghifile; var f:text; begin assign(f,fo); rewrite(f); write(f,n-c[n,n]); close(f); end; begin docfile; xuli; ghifile; end. 6
ADSENSE

CÓ THỂ BẠN MUỐN DOWNLOAD

 

Đồng bộ tài khoản
2=>2