Вы находитесь на странице: 1из 9

Bangladesh Olympiad in Informatics

National Contest 27th March, 2010


hosted by

Ahsan llah !ni"ersity of #ngineering and $echnology

Name: Student ID: College/School:

$as% 1 &ogical 'roblem (100 'oints)


1. Given 13 coins, it is known that any 1 o! them can "e divided into two sets o! e#ual weight. $%ove that all o! them has same weight. . &wo "%othe% sold a he%d o! shee' they owned. (ach shee' was sold in '%ice same as num"e% o! shee' in he%d. &he money was divided in !ollowing manne%, )i%s olde% "%othe% took 1* taka then younge% "%othe% took 1* taka. +t the end, it was younge% "%othe% tu%n and the%e was less that 1* taka. &o make the division ,ust olde% "%othe% gave his 'en to younge% "%othe%. Calculate the '%ice o! the 'en. 3. -hat is the !inal digit o! the num"e%

-he%e the%e is 1**1 sevens. -hat a%e the !inal two digits. /. &wo student o! school and !ew student o! college took 'a%t in a chess tou%nament. (ach student 'layed once against othe%. &he two students o! school got 0 'oints each while each o! the college student got same 'oint. I! in each match winne% gets 1 and lose% gets * 'oint o% "oth 'laye% gets 1 'oint i! the game is a d%aw the calculate how many college student 'a%tici'ated. 2. Show that
1 1 1 1 ... = log N log 3 N log 1** N log 1** ! N

x 1 x x3 x / x x 3 x / x 2... x n3 x n x n1 x n x n x n1 x n x 1 x n1 x n x 1 x x n x 1 x x3 =*

3. 4et 51,5 ,....5n a%e all eithe% 1 o% 61. I!

&hen '%ove n is divisi"le "y /. 7. 8ou have to 'ack N s#ua%es o! same si9e :side length S; inside a ci%cle o! %adius <. (ach s#ua%e =>S& touch the ci%cile?s "ounda%y at (@+C&48 two 'oints. )ind the ma5imum 'ossi"le value o! S. Give you% answe% in te%ms o! < and N. 0. )ind the ne5t )A>< te%ms !o% the !ollowing se#uence, *, 1, , 3, 3, 11, *, 37, 30,

B. $ack th%ee s#ua%es o! same si9e :side length S; inside an e#uilate%al t%iangle o! side length & , what is the minimum value o! &. Give you% answe% in te%ms o! S. ans: &C=in D SE: s#%t:3; F 3/ ; 1*.8ou have two kinds o! a%ithmetic o'e%ation6 eithe% Dou"le cu%%ent value, o% inc%ement cu%%ent value. Sta%ting !%om 1 !ind the minimum num"e% o! o'e%ations to meet *1*. Show the se#uence. 11.8ou and you% !%iend a%e 'laying a game. &he%e a%e N sticks. +ny 'laye% can take away at least 1 stick and at most G sticks :G H N;. &he 'laye% who !inds no sticks le!t loses. 8ou sta%t the game. -hat is the condition o! N and G so that you can gua%antee that you will win :no matte% how well you% !%iend 'lays;.

$as% 2 to * 'rogramming 'roblem (100+,-,00 'oints)


$as% 2. '/O0!C$ 1!M
Given a se#uence o! num"e%s a 1 , a , ... , a n , com'ute the value o! the !ollowing e5'%ession: S = a i a j 1 i j
i =1 j = 1 n n

IN'!$ &he !i%st line o! the !ile in'ut contains a 'ositive num"e% n. &he !ollowing line contains the num"e%s a 1 , a , ... , a n se'a%ated "y a single s'ace. CON1$/AIN$1 1 n1* 2 ; 1 a i1* 2 )o% test cases wo%th 12 'oints n will "e less than 1***. O!$'!$ &he !i%st line o! out'ut should contain a single num"e%, the %e#ui%ed value. #2AM'&# IN'!$ AN0 O!$'!$ Inp t 2 11111 O tp t 1

'/O3/AMMIN3 1!33#1$ION >se long long dataty'e to calculate the answe%. &he !o%mat s'eci!ie% !o% long long is 45lld6.

$as% 7. /o nd $rip
'/OB&#M 8ou% team decided to take a %ound t%i' in the host count%y a!te% the com'etition. 8ou want to t%avel to a destination city and %etu%n to the sta%ting city. &he only %e#ui%ement you% team s'eci!ied is that the !o%wa%d %oute to the destination city and the %etu%n %oute "ack to the sta%ting city must contain the least 'ossi"le num"e% o! common %oads. :+ %oute can not contain any %oad twice o% mo%e times.; 8ou a%e to w%ite a '%og%am that com'utes two %outes "etween the sta%ting city and the destination city so that the num"e% o! common %oads in the two %outes is as small as 'ossi"le. IN'!$ &he !i%st line o! the in'ut contains two intege%s, S and D :S HI D;, the la"els o! the sta%ting and the destination cities, %es'ectively. &he second line contains two intege%s, N and M, whe%e N :3HD N<= 1***; is the num"e% o! the cities and M : HD = HD 1*****; is the num"e% o! the %oads "etween the cities. &he cities a%e la"eled !%om 1 to N. (ach o! the ne5t M lines in the !ile contains two intege%s, P and Q :1HD P, Q HD N, P HI Q;, meaning that the%e is a two6way %oad "etween city P and city Q. &he%e is at most one %oad "etween any two cities. O!$'!$ &he !i%st line o! the out'ut must contain one intege%, the least 'ossi"le num"e% o! common %oads o! the !o%wa%d and the %etu%n %outes. &he second line should contain a !o%wa%d %oute as a se#uence o! city la"els, including the sta%ting and ending city. &he thi%d line should contain a %etu%n %oute as a se#uence o! city la"els :again including the sta%ting and ending cities;. I! the%e a%e mo%e 'ossi"le 'ai%s o! %outes with the same least num"e% o! common %oads then you% '%og%am may out'ut any one o! them. I! the%e is no %oute !%om the sta%ting city to the destination city then the !i%st and only line must contain 61. #2AM'&# IN'!$ AN0 O!$'!$ Inp t 13 70 1 13 3 / /2 23 13 32/ /273 1 O tp t

72 37

3/A0IN3 I! the !i%st line o! the out'ut !ile contains the co%%ect answe% then you o"tain /*J 'oint on that testcase. I! the !i%st line contains a co%%ect solution and the second and thi%d lines contain co%%ect %outes then you o"tain !ull sco%e on that testcase.

$as% 8. 3reat 9in


Now you and you% two "est !%iends have won huge amount o! money !%om a lotte%y. Now it is time to divide the money among you%sel!. Kut un!o%tunately the amount is not divisi"le "y th%ee. +s a '%og%amme% you a%e wonde%ing what is the minimum amount no less than the amount you have won would ensu%e 'e%!ect dist%i"ution. IN'!$ &he !i%st line o! the in'ut contains a 'ositive num"e% n. <e'%esenting the amount you have won. CON1$/AIN$1 1 n1* 1** )o% test cases wo%th 12 'oints n will "e less than 1********. O!$'!$ &he !i%st line o! out'ut should contain a single num"e%, the %e#ui%ed value. #2AM'&# IN'!$ AN0 O!$'!$ Inp t 2 O tp t 3

Inp t 12

O tp t 12

$as% ,. :alid N mber


8ou like some num"e%s. 8ou say a num"e% I1 is valid i! it can "e w%itten as multi'lication o! num"e%s you like. )o% e5am'le i! you like L3,/M, then valid num"e%s smalle% that * a%e 3,/,B,1 and 13. )o% this '%o"lem given the set o! num"e% you like you have to !ind how many valid num"e%s a%e the%e "etween two num"e% a,". IN'!$ &he !i%st line o! the in'ut contains a 'ositive num"e% ', si9e o! the set o! num"e% you like. Ne5t line contains ' intege%s si, the num"e%s you like. Ne5t line contains two num"e% a,". CON1$/AIN$1 1 p 1* 1 si 2* 1 a b 1*B )o% test cases wo%th 12 'oints ' will "e less than /. )o% test cases wo%t anothe% 12 'oints :"6a; will "e less than 1***** O!$'!$ &he !i%st line o! out'ut should contain a single num"e%, the %e#ui%ed value. #2AM'&# IN'!$ AN0 O!$'!$ Inp t O tp t 2 3/ *

Inp t

O tp t

3/ 1* *

$as% *. 1tone
&he%e a%e some stones lying on the %oad. 8ou have to a%%ange them in non6dec%easing o%de% o! thei% weight. 8ou can move any stone to any 'osition. 8ou want to minimi9e the total weight :sum o! the weight o! the stones; you have to move. Inp t &he !i%st line o! the !ile stone.in contains a 'ositive num"e% n. &he !ollowing line contains the num"e%s a1,a ,.....,an se'a%ated "y a single s'ace. Constraints 1 HDnHD1*N2O1HDaiHD1*N/. )o% test cases wo%th 2* 'oint, n will "e less than o% e#ual to 1***. O tp t &he !i%st line o! stone.out should contain a single intege%: minimum total weight you have to move. In'ut / 71 3 / 71 2 11 3/230 Aut'ut 3 7 / 7 11

Вам также может понравиться