UBND TINH THAI NGTIYEN rci.THT CHoN HSG cAT TINH LoP 12 THPT
so crAo DUC vA DAo
Ngdy thi: l3l10 /20ts
MON : TIN HgC
r4o
oE csirus
ruuc
TOng quan ,O
bdi:
180 phrit
khdng
ki thdt gian giao ili
tni
Bei
Tdn file bdi ldm
Tdn file dft li6u
;^
-, . !,.
I en llle ket qua
1
N{IMBERS.*
NUMBERS.INP
2
BPHONE.*
J
BROAD.*
D6u * dugc thay
OO
AO
Thdi gian tdm
Gioi han thoi eian mditest
D.Om
NUMBERS.OUT
2 siiry
6
BPHONE.INP
BPHONE.OIIT
2
sie,v
7
BROAD.INP
BROAD.OUT
2 sidv
l
ttri5 UOi PAS hoflc CPP cria ng6n
ngf lflp trinh
sri dpng tuong img
li
Pascal ho[c C++
ttri c6 3 trang.
HAy lflp chuong trinh gi6i c6c bdi to6n sau ddy:
Bni 1: 56 l6m (6 tli6m)
tu6n n ban hgc sinh th6ng minh y6u thich ci m6n Toi[n hgc vi mdn Tin hgc. TuAn vira nghi ra mQt
thuft tor{n m6i md ho5 mQt vln bin. Vi6c md ho6 ndy phlr thuQc vdo viQc sinh ra si5 t.u nhi6n lon nh6t bing
c6ch gh6p li6n c6c s5 nguy6n ducrng cria mQt day s6 sau khi c6 th6 thay d6i v! tri c5c sli trong day s6 <16.
ChEng h4n: niiu dey s6 g6m c5c s5: 9, 55, 8 thi s5 nguy€n lon nh6t c6 th6 tao thanh ld: 9855.
YGu cAu: Em hdy vi6t chuong trinh x6y dpg s6 nguy6n duong lcm nhSt bing cSch ghdp li6n crlc s6 nguyCn
duong trong mQt ddy s6 sau khi c6 th6 thay ddi vitri cfuc st5 trong day s6 dO.
Dfr liQu: Vdo tu file v5n ban NUMBERS. INP
c
o
< n < L06) h s6 s6 nguy6n ducmg trong day s6.
Ddng thri hai chr?an s6 nguy6n ducrngal, o.2,...,an(2 aora1}e,vi=7,2,...,n) thii hiOn c6c
Ddng thir nh6t chria mQt sti nguy6n duong n (2
s6
nguyOn duong trong ddy si5. C6c si5 t.en ctng mQt ddng cSch nhau mQt d5u c6ch tr,Sng.
K6t qui: Ghi
ra file vdn ban NUMBERS.OUT ghi si5 nguy6n duong lon nhAt co th6 x6y
dpg tu day sti da cho.
Vi dg
NUMBf,RS.INP
NUMBERS.OUT
9855
3
9558
Bdri
2: LEa chgn c6u hinh (7 tli0m)
CEO Nguy6n Tri Quang dang c6 ktl hoach sin xuAt Bphone th6 he thft hai. HiQn nay, tr6n thi trulng
nhi cung c6p thitit bi b0 phfln cho Bphone, n6n vi CEO niy tlang rAt kh6 khln trong viQc chon nhd
cung c6p thi6t bi. Em hdy vii5t mQt chucrng trinh girip 6ng Nguy6n Tfr Quing di5 chqn dugc 4 nhd cung c6p cho
c6
rlt
nhi6u
4 bQ phfln chfnh cta Bphone md t6ng di6m ttSnh gi6
h lon
ntr6t va t6ng gi5 thdnh kh6ng quLV.
B6n b0 ph{n chfnh ld: chip, man hinh cim img, bo mpch vi v6 m6y. M5i bO phfn ndy c6 n nhd cung
c6p, vd m5i U9 phfn cria mQt nhd cung cdp c6 mQt t1i6m drffi giri cria c6c kh6ch hing. T6ng di6m d6nh gi6 c:fra
chiiSc m5y Bphone beng t6ng
YGu
ciu:
phfn chinh niy.
Bqn hdy vi6t m6t chuong trinh x5c tl1nh t6ng tli6m d6nh gi6ld lorr nh6t cO th6 dugc chgn tu cdc nhd
cung img md ti5ng gi5 thanh kh6ng qu6V.
"eTrang
7*
Dfr liQu: Vio tu file vdn ban BPHONE. INP
o
o
D6ng thir nh6t chria 2 s6 nguyCn duong n (2 < n < 103) h so nha cung img cria m5i loai thi6t bi, vd
(Z < V < 10e) h gioi han tr6n cria t6ng gi5 thnnh cria 4 b0 phfln chfnh.
V
Ddng thriktii5p theo (ktu I d6n a) chfuancap s6 nguydn duong (v6,cy1),(vp2,c112),..., (10pn,c1rr),
trong d6 m5i cdp(vur,cy) thd hiQn gi5 thanh vd di6m tlSnh gi6 ciabQ ph6n thri k cria nhd cung c6p thri f
(1 1 vyi,cyi < L}e). C6c sti tr6n ctng mQt ddng c6ch nhau mOt d6u c6ch trting.
K6t qui: Ghi ra file vin
ban BPHONE.OUT mQt sii duy ntr6t
n t6ng
dinrh
gillon
nh6t cria Bphone m6i
c6 thri d4t clugc md t6ng gi6 thanh kh6ng quLV.
Vi dB
BPHONf,.INP
BPIIONE.OUT
2L0
11
2233
2245
2258
2268
Bii 3: TuyiSn dudng tlgp nh6t (7 tli6m)
thi trulng du lich trong nu6c, C6ng ty du lich Xuy6n Vi6t mu6n lAp ra mdt
tuy6n dulng du lich m6i tir He NOi tldn Hb Nrii C6c tinh Th6i Nguy6n. Sau thli gian d)i thio luAn, C6ng
ty cl6 tlua ra m6t phucrng 6n chon tuy6n clu&ng niy nhu sau.
H5y tu&ng tucrng ring quanh tuy6n cludng l6n Hb Nrii C6c c6 N ilia cli6m tluoc tl6nh s6 tir 1 (li
Ha Ndi) cl6n N 0e Hb Nrii C6c) v) M con clulng. M6i con tludng ndi hai tlla clidm vi c6 m6t chi s6 x6p
hang vb v6 clep. D0 dai cfia tuy6n dulng cluoc tfnh bing s6 con dulng cti qu4 vi v6 clep cta tuy6n dulng
clucrc th6 hi6n bing diy chi sd x6p hang cria cfc con clulng theo thfr tu cli qua tu Ha NOi ttdn Hb Nrii C6c.
D6 ph6t tridn thdm
Trong <16, ddy si5 1ar, o2, ...,a,r) du-o. c ggi ld c6 thri t.u tu tlitin nh6 hon (bt,bz, ...,bn) khi
t6n tai vi tri k (1 < k ( n) sao cho ay I byvit ai : biV t < i < k.
tinh
vi
chi khi
clulng du lich tu Ha NQi d6n Hb Nfi Cdc sao cho tl6 dli
ctia tuy6n tlulng tI6 l) ngSn nhdt vi thrl tu t& cli6n cria diy chi sd x6p hang thd hi6n v6 elep cira tuy6n
YGu cAu: Em hdy vi6t chuong
cludng
d6li
x6c dlnh tuy6n
nh6 nhdt.
Dii IiQu: Vio tu file v[n
ban BROAD. INP
o
o
Ddngclhughihais6lvvi M(L< N < 10s,7 < M < 106).
tvt6i ddng trong M ddng ti6p theo ghi ba s6ai,bid ri th6 con dudng hai chiEu n6i hai clia clidm a;
vitbic6chis6x6phangl)4[13ai,bi3N,Lsri
K6t qui: Ghi ra file vln ban BROAD.OUT g6m hai ddng:
o
o
Ddng clhu ghi sd r la d0 dii tuydn dulng ngin nhdt t* He NOi d6n Hb Nrii c6c.
Ddng thr! hai chrla I sd thd hi6n chi s6 x6p hang cfia cdc con dulng trdn tuydn clulng ngin nhdt
c6 thd thr? tE tD cli6n nh6 nhdt. C5c s6 tr6n cirng mQt ddng c6ch nhau mQt d5u cSch tr6ng.
Vi dg
BROAD.II{P
45
L22
133
243
34L
311
BROAD.OUT
2
13
eTrang
2*
v)