Ngubi thing cuoc se 18 ngubi tim duac cach di chuyin qua nhi&u vbng trbn nhit.. Hai s6 1iSn tikp tren mat dbng duqc ghi cach nhau bai dhu citch..[r]
(1)so GIAO ~ y c VA BAO TAO KI THI CHQN HOC SINH GIOI QUBC GIA L ~ P 12 THPT NAM 2008
M6n: TIN HOC
Th&i gian: 180 ph6t (khdng kdthai gian giao dk') NgAy thi: 29/01/2008
(D& thi &rn 3 trang)
T ~ N G QUAN BAI THI
~ b u * dvqc thay the bM PAS ho$c CPP &a ngSn ngir lap trinh dvpc sir dpng tumg h g IP Pascal ho$c C t t Hdy lgp tdnh gidi cdc bhi todn sau:
File kk> qud SE@SAME OUT JUMP OUT GIFTS OUT
BAS (6 diem) Trb chui v&i diiy 96 Bhi
Baa 2 ai 3
Hai ban h ~ c sinh Iuc n h h r6i nghT trb chai sau day ~ i ban c h ~ n tru6.c mat day sb g6m n s6 nguyen, GiB s diiy s6 m8 ban thu nhht chon 18
File chumg trinh SEQGAME.* JUMP * GIFTS * T2n bdi
Tro chui v & i d&y 98 Lt3 cd
ma ~ & t
cbn day ss6 mil ban thb hai chon 16
File dik li& vdo SEqcAWE I N P JUMP I N P G I F T S I N P
M& luqt chui m6i ban dua mot s8 hang dZiy s8 cua minh N&U ban thir nhht,dua s6 hang bi (1 I i 5 n), cbn ban thir hai dua sh hang c, (1 < j 5 n) thi gia cua luqt chai 66 sC 1A Ibi + cjl VI dv: GiB sir day s6 ban thu nhht chon 18 1, - 2; cbn diiy s6 ma ban thli hai c h ~ n 18 , Khi 66 c6c khh n h g c6 th& cba mot Iuqt chui 18 (1, 2), (1, 3), (-2, 2), (-2, 3) Nhu vgy, gih nh6 nhdt c6a mat luqt chui s6 chc luqt chui c6 th& la tucmg irng v6i gid cua luqt chai ( - , ) ,
YCu c h : HZiy x k djnh gia nh6 nhht clia mot l u g chai s6 cac iuqt chai c6 thi
Dil lieu: Vho tir file van bhn SEQGAMEJNP:
Dbng dhu tien chlia s6 nguyen ducmg n ( n 5 10');
Dbng the hai chua d8y s6 nguyen bl, bz, , bn (Jbf( 5 lo9, i = 1 , 2, , n);
9
Dbng thli ba chira day sb nguyen cl, cz, , c, (Icjl 1 10 , j = 1 , , , n) Hai sb lien tiCp tren mat dbng duqc ghi chch bCri dbu cdch
~ & t quH: Gh'i file viin bhn SEQGAME.OUT gia nh6 nhht tim duqc
Vi dp:
SEQGAME INP SEQcAME OUT
Rang buijc: 60% s6 tests ung vdi 60% s8 di&m cda bai c6 I < n 5 1000
(2)NhAy Ib cb la tro chai dbn gian cua Viet Nam Ngubi trtn hanh tinh X ciing rht thich trb chai va h~ dB chi bitn trb chui nhu sau: Tren rnpt vE n vbng trbn duqc dhnh s6 t u I b n n Tai vbng trbn i ngubi ta di&n s8 nguyCn duong u, Hai s6 tren hai vbng trbn y kh6ng nhht thi&t phai khhc ~ i d$n ngubi & ~ ta ve chc mQi ten, m8i miii t t n h u h g tir mat vbng trbn dbn mot vbng trbn k h b Quy k c v& mGi tCn la: N&U co ba s6 a,, a,, a k thoii man: ak=a,+a, thl ve mfii tCn
h u h g tir vbng trbn i d&n vbng tron k va mfii ten h u h g tir vbng trbn j d&n vbng trbn k NguZri chui chi dugc di chuy&n tir mQt vbng trbn d&n vbng trbn khac n&u c mCii ten tir vbng trbn xuht phat h u h g dkn vbng trbn dich Ngubi chai c th& xu& phat tu mot s6 c8c vbng tron, di chuy&n the0 chc mCii e n d3 vC d& d&n cac vbng trbn kh8c Ngubi thing cuoc se 18 ngubi tim duac cach di chuyin qua nhi&u vbng trbn nhit
Vi d ~ : V&i 5 vbng trbn va ctic s6 vbng trbn 18 1, 2, 8, 3, 5, trb chai duac trinh bby hinh dudi day:
Khi 66 c6 the di chuy&n duqc nhieu nhat qua 4 vbng trbn (tucmg irng v6i dubng di chuy&n Bugc t6
d8m trCn hinh vi5)
Y&u chu: Hay xdc djnh xem trong tro chai m6 ta ir trtn, nhi&u n h h c th& di chuy&n duuc qua bao nhitu vbng trbn
Dit lieu: Vho tir file viin ban JUMP.INP:
Dbng dfru tiCn chua s6 ngupen n (3 5 n e 1000);
Dbng thd hai chua day s6 nguyen duong a,, 0 , , a, (ai 5 lo9, i = 1, 2, , n)
Hai s6 1iSn tikp tren mat dbng duqc ghi cach bai dhu citch
~ t quH: Ghi file v8n ban JUMP-OUT s6 I u p g vbng trbn trCn duirng di chuy&n tim dlrqc
Rang bugc: 60% s6 tests ung v6i 60% s6 diim clia bai co 3 5 n 100
(3)~ h u h n bl don n5m m8i, CBng ty bhnh keo Huung Dua dZi 1Am mot dim s6c61a cvc Idn vCri muc dich ghi ten minh vho sAch kjl Ipc Ghi net 88ng th&i q u h g bit t h u m g hi& tru6.c c6ng chbng ~ & n s8c61a c hlnh vu6ng kich thuCrc 2kx2k 6, tqo thAnh lu6i vu6ng 2k h&ng vA 2k cot Cac h h g dugc ddnh sh tir 0 d&n 2k-1 tit trCn xuhng dubi, c8c
cot duqc dinh s6 tit 0 d&n 2k-1 tir tr&i sang phhi 6 n h tren hang i vA cet j duqc goi lit ( i , J) Sau bu6i tnmg bhy gi6i thieu s i n phbm,
tbm s6c8la duqc cht nh6, chia cho moi ngudi, m8i ngubi duqc mot cua chikc banh ky luc Bo phen tikp thi d8 $n vao hai k h l c
@, q) vA ( 1 , v) m6i mat dbng xu Vj khach nao may mhn nhgn dirac s6c6la co &ang xu s5 dujrc tang r i t nhiku san pidim dQc dBo c ~ i a
catlg ty
Vi chikc banh rht lint n2n C6ng ty dB thi&t k& mot m6y tit banh May thuc hi$n dBy cac thao thc cht, bit dfiu tir c h h g banh chi gbrn 1 thm s6ciila ban bfiu, m8i thao t i c gbm hai buCrc sau:
Buac 1: ~i!it ngang song song vai canh chhng banh chia ching s6c61a hai phhn bhng nhau, up ch6ng banh b2n dubi Itn ch&ng banh b2n tren cho mep duui de Ien mep trtn BuCrc 2: ~ h t doc song song vdi canh ch6ng banh chia chbng sdc6la hai phhn bing nhau, 6p c h h g banh bCn trii 1Cn trCn chbng banh bCn phhi cho mCp trai d& ICn m6p phhi
Nhu v@y sau m8i l&n thyc hien thao tAc cht, chi&u dai vA chi& rang cua chc d m s6c61a gihm di mot nha Sau k l$n thuc hien thao thc cit, cac ccir d m s k l a sC duuc x & ~ mot cot Khach nhbn biinh xep hang mot vii duqc dsnh sb tir trd di, ngubi thir rn sC nh$n duuc s6c61a thu m t u tren xu6ng duiri (1 5 m Zk ~ ~ )
Vi du, vdi k = vB b&ng xu duqc in v i o cac (0, O), (1, l), viec thuc hi$n cac thao thc cht duqc trinh bay trCn hinh vC minh hoa u tren Trong vi du nay, vi khfich thu nhht vA thu ba sZ la nhfing ngubi nhen dugc t$ng phi!im cda CGng ty
Y e u chu: Cho bi&t cac s8 nguy&n k, p, q, u, v Hiy x i c dinh s6 thb t u cua hai vi khlich may mhn duqc nh& qua
DB litu: Vao tir file v9n ban GIFTS-INP ,dm mat d6ng chua s6 nguyen k, p, q, u, v cric s6 cach bbi dhu cach
~ & t qua: Dua file v8n bar GIFTS.OUT mat dbng chua hai s8 nguyen la s6 thu tkr cua cac vi khach may mhn Hai s6 phai cach dung met d6u cach
Vi du:
Rang buQc:
1 k < , O s p , q, u, v ~ - l ;
60% s8 tests ling v8i 60% sb di&m clia bai co I k 1
Ghi chin:
Thi sinh khdng duqc su dung tai lieu Cbn bo coi thi khdng giai thich gi [him