You are on page 1of 3

S GIO DC & O TO CN TH TRNG CHUYN L T TRNG

THI CHN I TUYN OLYMPIC 30/04 - KHI 10 MN: TIN HC NM 2007 (Thi gian lm bi: 150 PHT)

NI DUNG
RY NU Bng phng php chp khng nh xc nh cc vng la ang b ry nu ph hoi, trn nh chp ca vng t ln hnh ch nht, nhng vng t c mu xm l nhng vng t b ry nu ph hoi, nhng vng c mu xanh l nhng vng t cn tt. xc nh v tr ca cc vng t b ry nu ph hoi hay khng b ph hoi, ngi ta chia hnh ch nht trn thnh li cc vung, vi mi l mt n v din tch. Yu cu: Hy lp trnh xc nh cc vng t b ry nu ph hoi, ch ra cc vng t gm cc no, tng din tch v din tch tng vng. D liu: c t trong file vn bn RAY.INP gm: Dng u l kch thc vng t cho bi hai bin M, N vi (1 M, N 250); - M dng tip theo, mi dng cha N ct cho bit t c ry hay khng (1 nu c ry, 0 nu khng c ry).
-

Kt qu: Ghi ra trong file vn bn RAY.OUT gm: - Dng u ghi tng din tch vng t c ry; - Cc dng tip theo: s u tin l din tch cc chung cnh c ry, k tip l v tr cc c ry. V d: RAY.INP 56 110000 011000 000000 001100 100000 RAY.OUT 7 4 [1, 1], [1, 2], [2, 2], [2, 3] 2 [4, 3], [4, 4] 1 [5, 1]

Tng tr ca mch in Mt mch in gm N in tr c mc vi nhau theo kiu song song hoc ni tip hoc hn hp c hai kiu. Ngi ta biu din cc mch bng mt biu thc cho di dng mt xu k t vi c php v ng ngha c xc nh thch nh sau: Nu Rx, Ry l hai in tr mc ni tip vi nhau th c biu din l: Rx+Ry. Khi , in tr ca on mch mc ni tip ny c tnh theo cng thc: R = Rx + Ry;
Trang 1/3

Nu Rx, Ry l hai in tr mc song song vi nhau th c biu din l: Rx*Ry. Khi , in tr ca on mch mc song song ny c tnh theo cng thc: 1/R = 1/Rx + 1/Ry. V d, mch in bn di s c biu din di dng biu thc l: (B+((A+(C*(D+G)))*(E+F)))

Yu cu: Cho mt mch in th hin bng mt xu k t theo c php nu trn, trong mi in tr c tn l mt k t khc nhau, cng vi tr s in tr tung ng ca chng. Lp trnh kim tra tnh ng n ca biu thc mch, nu ng th tnh in tr ca mch. D liu vo: c t file vn bn MACH.INP c cu trc nh sau: Dng u tin l s N - s cc in tr trn mch in; - Dng th hai cho mt xu k t l biu thc mch tun theo c php m t mch in ni trn. - N dng tip theo, mi dng gm tn ca in tr (l mt k t trong bng ch ci) v gi tr tng ng ca in tr , cch nhau bi mt khong trng. Kt qu ra: Ghi ra file vn bn MACH.OUT ch gm mt dng cha mt s duy nht l gi tr tnh c ca in tr tng ton mch. V d: MACH.INP 7 (B+((A+ (C*(D+G)))*(E+F))) A 10 B5 C8 D4 E8 F6 G4 MACH.OUT 12

Trang 2/3

Di chuyn trn hnh trn Trn mt phng cho n hnh trn (n < 2000). Hnh trn th i c xc nh bi b ba s thc (x[i], y[i], R[i]) ln lt l ta tm v bn knh ca n. Chi ph di chuyn trn mi hnh trn bng 0. Chi ph di chuyn gia hai hnh trn bng khong cch gn nht gia chng (nu hai hnh trn khng c im chung th khong cch ny bng khong cch gia 2 tm tr bn knh, ngc li th bng 0). Yu cu: Hy tm phng n di chuyn gia hai hnh trn cho trc vi chi ph t nht. D liu vo: c t file vn bn HINHTRON.INP c cu trc: Dng u tin ghi s nguyn dng N (N 100) l s hnh trn; Dng th 2 ghi s hiu ca hnh trn xut pht v hnh trn kt thc; - Trong N dng tip theo, mi dng ghi thng tin v hnh trn th i, gm 3 s thc ln lt l honh tm, tung tm ca hnh trn v bn knh ca n.
-

Kt qu: ghi ra file vn bn HINHTRON.OUT


-

Dng th nht ghi tng khong cch di chuyn (2 s l); Dng th hai ghi s hiu ca cc hnh trn trn ng i tm c. HINHTRON.INP 5 15 001 121 441 341 041 HINHTRON.OUT 1.83 125

V d:

----- HT -----

Trang 3/3