B ANGLADESH ANGL ADESH INFORMATICS OLYMPIAD 2014
B ANGLADESH ANGLAD ESH INFORMATICS OLYMPIAD 2014
Divisional Round Senior
Bangladesh Informatics Olympiad 2014 Divisional Competition Senior Group Number ): আইটড না (ID Number):
_________________________ ________ _________________________________ __________________________ __________
নভ (Name):
___________________________________________________
(Class):
___________________________________________________
টন (Institution): জ টযখ (Date of Birth):
___________________________________________________ _____________________ _________________________________ _______________________ __________________ _______
পন না (Phone):
___________________________________________________
ই -ভই ( E-mail):
___________________________________________________
Instructions):
১. ফা ফ ইাদযটজ এ িট বলয ম কন একিটদ একিটদ উতয য় মদফ। মদফ।
(
You can answer either in Bangla or
English.)
২. উতয াট য় ফঞনীয়। ফঞনীয়। (The answers should be as brief as possible.) ৩. জন ‘জন যকয ’ অাদ উদটখ টফলয়দয টফসটয টফসটয ফরন দয দল দল ামু । ( ‘Required knowledge’ are described at the e nd of the question paper.) ৪. ধযর ভধদনয দ দ গটরটক পভু , ধদ ধদ ফর ন , টভা কড -
Topics mentioned under
এয ম কন টকছু ই রদমগ।
(For general solutions Mathematical formula, step by description or programming code - anything is acceptable.)
৫. আাটক উতয ভূ য়নদমগ , ই মিু ফ উতয য়য জদ জদ উৎট কয দ। ( Partial answers will also be evaluated, so we encourage you to answer as much as you can.) ৬ ভি ৭ িট। টিট দয ভন ২০। (Number of questions is 7. Each question carries 20 marks.)
Question 1:
এিক টফশটফদয় নূ নভ কজন ছ বট বট কযদ কযদ ু টভ টনট বদফ বদফ ফদ দয দয ম অ N জন জন ছ একই জ েদক এদদছ ? ধদয ন দয জ াখ K (How many students must be enrolled in a university to ensure that there are at least N students students who come from same district? Assume there are K different districts) A. ধযন ূ িট টখ। (Write the general formula) [10] B. উতয টখ , মখন N = 2, K = 3 (Give the answer when N = 2, K = 3) [4] C. উতয
টখ , মখন N = 201, K = 50 (Give the answer when N = 201, K = 50) [6]
Question 2: Required Knowledge): Knowledge): াখ (Binary Numbers)
ফইনযী N দঘ দঘ য কদ ফইনযী াখ আদছ ম একিট 1 টদয় য় েঅফ েঅফ ইিট 0 টদয় ল য় ( N >= >= 3)? (How many binary numbers of length N starts starts with a 1 or ends with two 0s ( N >= 3)?) A. ধযন ূ িট টখ। (Write the general formula) [10] B. উতয টখ , মখন N = 4 (Give the answer when N = 4) [4]
C. উতয
টখ , মখন N = 10 (Give the answer when N = 10) [6]
Question 3:
একিট আয়দ য় আদছ , ময ঘ N এফা M (N >= >= M )। এখন এয ভদধ িট ভন ফদধ য ফৃতদক ফদ দফ মন য একিট অযিটদক অযিটদক ছ ন কদয এফা ু দযু টয আয়দদয ভদধ অফন অফন কদয। এই ফৃ ত ফৃ ত িটয দফ ফধ ক ক দ দয ? (Given a rectangle of length N and and width M (N >= >= M ), ), 2 equal sized circles should be placed inside the rectangle such that they don't overlap and remain completely inside the rectangle. What will be the maximum radius of the circle?) A. ধযন ূ িট টখ। (Write the general formula) [10] B. উতয
টখ , মখন N = 7, M = 3 (Give the answer when N = 7, M = 3) [4] C. উতয টখ , মখন N = 4024, M = 2014 (Give the answer when N = 4024, M = 2014) [6]
Question 4:
ভয কদছ এিক য় গযভ কড়ই আদছ। কড়িইদ ু টভ ভছ বজদ চ। কড়িইদ একেদ ি ি ভছ বজ ময়। ভদছয এিক টঠ টঠ বজদ ১ টভটিন টভটিন ভয় দগ। এখন ভদক ভদক মট N ি ভছ য় েদক েদক , দ নূ নভ ক ক ভদয় ু টভ ফদ ভছ বজদ বজদ যদফ ?একিট ভছ ু দযু টয বজদ দ দ য ই টঠই টঠই বজদ দফ। (You have a frying pan for preparing some fishes. You can fry at most 10 fishes at a time. You also need 1 minute to fry one side of a fish. If you have N fishes, determine the minimum time you would require to fry all of them? In order to completely fry a fish, you need to fry both its side.) A. ধযন
ূ িট টখ। (Write the general formula) [10] B. উতয টখ , মখন N = 4 (Give the answer when N = 4) [4] C. উতয টখ , মখন N = 10 (Give the answer when N = 10) [6]
Question 5: Required Knowledge) Recurrence relation) একিট আয়দ য় , ময
ধয ভদক ঘ ২ এফা N (২xN)। ভয কদছ ই ধযদনয িই আদছ , ২x১ এফা ২ x২। ু টভ মট এদযদক এদযদক ফফয কদয আয়দিটদক আয়দিটদক ূ যন কযদ চ দ ক বদফ কয মদফ ? টনদচয উযন দ খ । ু টভ ম খু ট িই ফফয কযদ য, টক আয়দদয একই ঘদয একটধক িই ফফয কয মদফ ন। ( Suppose you are given a rectangle of length 2 and width N (2xN). You have two types of tiles, 2x1 and 2x2. If you want to fill the rectangle using only these two types of tiles then in how many ways can you do it? See example below to understand. You can use as many tiles as you want, but you can’t put a tile over another tile.) N=1
N=2
N=3
A. টযকদয
টযদনিট টখ। (Write the recurrence relation) [10] B. উতয টখ , মখন N = 5 (Give the answer when whe n N = 4) [4] C. উতয টখ , মখন N = 10 (Give the answer when N = 10) [6]
Question 6: Required Knowledge) Tree)
ভদক এিক ট য় আদছ। এয টপ নডদদ ( ফয টনদচয নড মদয মদয আয কন চই নই ) টকছু ভন য় আদছ। অ ফ নদডয ভন ভ ন দ য মদ উতযযী আদছ ( য টনদচ মদ েকদ েকদ টপ ফ টপ ছড় মদ নড আদছ ) দয কদয ভদনয ভদনয মগপ। ভদক ভদক ট িটয ট িটয িদয( ফয উদযয নড ) ভন ফয কযদ দফ। মভন টনদচয টদ ি দ A। B নদডয চইদয ি২ টপ আদছ মদয ভন েমদভ 1 এফা 2। ই B এয ভন দ 1 + 2 = 3। আফয A নদডয আদযিক চই আদছ ময ভন 3। অএফ ি নড A এয ফ দভি ভন দ 1 + 2 + 3 + 3 = 9 । (You are given a tree. Its leaf nodes (the nodes which have no other child) have some values. All the other nodes’ values are the sum of their successors (all successors (all the nodes you can get when you go down in the tree from this node). You have to compute the value of the root in this tree. For example, in the following tree, the root is A. Node B got two children whose values are 1 and 2. So B’s value is 1 + 2 = 3. Again node A got another child which has a value of 3. So total value of root node A is 1 + 2 + 3 + 3 = 9)
A. দয টদ িদয ভন ফয কয। ( Compute the value of root node for the tree in left). [4]
B. দয টদ িদয ভন ফয কয। ( Compute the value of root node for the tree in left). [6]
C. এই ফদদভয একিট ধযন ভধন । (Give a general solution for this problem) [10]
Question 7:
এিক ফদড টনদচয টনদচয ভদ কদয 1 েদক অীভ ম ক নয খ আদছ। আদছ। এখদন ফয টনদচ এফা ফদভয ঘয মিট 1 আদছ য নাক (1, 1)। (2, 3) এ আদছ 8। ছটফদ 25 ম েকদ ফড িটয ইজ অদনক ফড় মদ অীভ ম ক াখ খ ময়। ভদক ম কন ঘদযয ভন ফদ য নঙ ফয কযদ দফ। (You are given a board just like the following image where numbers from 1 to infinity are written. Here, at the bottom-left cell, where 1 is written, has the coordinate (1, 1). 8 is in coordinate (2, 3). In the picture only numbers up to 25 are shown but the board is big enough to hold all the numbers up to infinity. Given a value in any cell you need to find out the coordinate of that cell containing that number.)
A. 39 ম ঘদয আদছ য নাক ক ? (What is the coordinate of the cell which contains 39 in it?) [4]
B. 998500 ম ঘদয আদছ য নাক ক ? (What is the coordinate of the cell which contains 998500 in it?)[6] C. কন একিট নয টদ য নাক ফয কযয ক যয একিট ধযন ভধন । (Given a number, write a general solution to compute the coordinate.)[10]
Appendix) (Recurrence Relation)
গটরটকবদফ , টযকদয টযদন এভন একিট ভীকযর মিট একিট অভদক ক কদয ময য টকছু যট যট য় েদক এফা যফ ী টিট যটদক যটদক আদগয টকছু যটয যটয পান আকদয ক কয ময়। (In mathematics, a recurrence relation is an equation which defines a sequence where one or more initial terms are given and each further term of the se quence is defined as a function of the preceding ter ms.)
উযর, টনদচয টযকদয টযদনিট টযদনিট কটয কটয (For example, consider the following recurrence relation) T(n) = 2T(n-1) + 1, T(0) = 0
ভনদয এিক িটফ িটফ ফনদ টনদচয টনদচয ভ য় (Building a table of values yields the following) n
0
1
2
3
4
5
6
7
T(n)
0
1
3
7
15
31
63
127
Binary Numbers)
মদকন াখদক এক ফ একটধক ২ এয ঘ এয মগপদ কফভ একবদফই ক কয ময়। কন াখদক ক কযদ ২ এয ম ক ঘ ফফয য় দয জদ ১ টদয় র কদয এফা ফটকদয জ 0 টদয় র কদয দয মগপদ মগপদ খ ময়। এদক ঐ াখয ফইনটয ফ য়। টনদচয টনদচয উযর খদ খদ টফলয়িট টযষয টযষয দফ। (It’s possible to uniquely express any number as a sum of one or more power(s) of two. We can express the number as a sum of each used powers of two multiplied by 1 and each unused powers multiplied by 0. You’ll get a better idea from the following example) 3
2
1
0
11 = 8 + 2 + 1 =1 x 2 + 0 * 2 + 1 x 2 + 1 x 2 = 1011 in Binary
েভ টকছু ফইনটয ফইনটয নয দ
ফইনটয (Binary)
0
1
2
3
4
5
6
7
8
9
10
0
1
10
11
100
101
110
111
1000
1001
1010
(Tree): A Node): এিক টফ ফ ফ। দয ছটফদ ি নড আদছ। ( point or object. In the figure, there are ten nodes.) Edge): ইিট নদডয ভদধ ক। এদক দয ভদধ একিট যখ িদন
ক কয য়। এজ এয িট নডদক একজন আদযকজদনয াদগ ামু ফদ ধদয নয় য়। উযর উযর দয ছটফদ ৩ এয েদ ৯ এফা ৪ ামু । ৬ এয েদ ৪ এফা ৭ ামু । ( The relationship between two nodes. It is represented as a line between two nodes. These nodes are considered to be adjacent to each other. For example, in the figure. 4 and 9 are adjacent to 3. 4 and 7 are adjacent to 6.) Root): একিট টফদল নড। ট এয ফদচদয় উদযয নড। এখদন ৩
ি। (A special node. It’s It’s the topmost the topmost node of the tree. Here 3 is the root.) Leaf): ট
এয ফয টনদচয নড নড মদয েদক আয কন নড টনদচ টনদচ টয য়ন দয টপ টপ নড ফ য়। ছটফদ ১ , ১০, ৭ আয ৫ দ টপ নডদ। (Nodes which are at the bottom of the tree which have no further child nodes are called leaf nodes. In the picture 1, 10, 7 and 5 are leaf nodes. ) Successor): ছটফ েদক উতযযীয ধযর টযষয দফ। এখদন ৪
নয নদডয উতযযী দ ১০ , ৬, ৫ এফা ৭।িদয উতযযী ি ফদ আয ফটক ফ নড। টদপয টদপয কন উতযযী েদকন। ( The idea of successor is best explained from the figure. Here node 4’s successors are 10, 5, 6 and 7. Root’s successors are all other other nodes. Leaves do not have any successors.) Tree): এভন টকছু নড নড এফা এদজয া মখদন ি ফী টিট
নদডয একিট ভ ূ ফ যী ূ েদক। কন টদ n িট নড েকদ এজ েদক n1 িট। ( Collection of nodes and edges such that every node other than the root has exactly one predecessor. A tree with n node has exactly n-1 edges.)
*
ANGL ADESH SH INFORMATICS B ANGLADE OLYMPIAD
2014
Divisional Round Junior
Bangladesh Informatics Olympiad 2014 Divisional Competition Junior Group Number ): আইটড না (ID Number):
_________________________ ________ _________________________________ __________________________ __________
নভ (Name):
___________________________________________________
(Class):
___________________________________________________
টষন (Institution): জ টযখ (Date of Birth):
___________________________________________________ _____________________ _________________________________ _______________________ __________________ _______
পন না (Phone):
___________________________________________________
ই -ভই ( E-mail):
___________________________________________________
Instructions):
১. ফা ফ ইাদযটজ এ ট ট বলয ম কন একটদ একটদ উতয ওয় মদফ। মদফ।
(
You can answer either in Bangla or
English.)
২. উতয াট ওয় ফঞনীয়। ফঞনীয়। (The answers should be as brief as possible.) ৩. জন ‘জন যকয ’ অাদ উদটখ টফলয়দয টফসটয টফসটয ফরন দয দল দল ামু । ( ‘Required knowledge’ are described at the e nd of the question paper.) ৪. ধযর ভধদনয দ দ গটরটক পভু , ধদ ধদ ফর ন , টভা কড -
Topics mentioned under
এয ম কন টকছু ই রদমগ।
(For general solutions Mathematical formula, step by step description or programming code - anything is acceptable.)
৫. আাটক উতযও ভূ য়ন -মগ , ই মু ফ উতয ওয়য জদ উৎট কয দ। (
Partial answers
will also be evaluated, so we encourage you to answe r as much as you can.) ৬. ভ ৭ ট। টট দয ভন ২০। (Number of questions is 7. Each question carries 20 marks.)
Question 1:
এক টফটফদয় টফটফদয় নূ নূ নভ কজন কজন ছ ছ বট বট কযদ কযদ ু ু টভ টনট টনট বদফ বদফ ফদ দয ফদ দয ম ম অ অ N জন ছ একই ছ একই জ জ েদক এদদছ েদক এদদছ ? ? ধদয নও ধদয নও দয জ াখ াখ K । (How many students must be enrolled in a university to ensure that there are at least different districts)
N students
who come from same district? Assume there are
A. ধযর ূ ূ ট টখ টখ । (Write (W rite the general formula) [10] B. উতয টখ উতয টখ , মখন N = 2, K = 3 (Give the answer when N = 2, K = 3) [4] C. উতয টখ উতয টখ , মখন N N = 201, K = 50 (Give the answer when N = 201, K = 50) [6]
Question 2:
ভদক একট ভদক একট ধয ধয য় য় আদছ আদছ । (You are given a series) 1, 6, 13, 22, 33, 46, ?, ?
A. ৭, ৮ ভ দ ভ দ টক টক টক টক ? েঅ ৎ দফধক িটহদয দন িটহদয দন টক টক টক টক ফদফ ফদফ ? (What are the 7 th and 8th term of this series?)[4] B. ৩০ ভ ৩০ ভ টক টক ? (What is the 30 th term?)[6] C. N ভ দয ভ দয জ জ ধযর ধযর ূ ূ টখ টখ । (Write a general formula formula for N th term) [10]
K
Question 3:
৩ ফ ফ আদছ আদছ , একট ফদ ফদ আদছ আদছ আদ আদ , একটদ কভ এফা কভ এফা অটদ অটদ ট ট পদয টভশর পদয টভশর । ট ফদ ফদ বু বু দফ দফ গদন আদছ আদছ । যভদন কদন যভদন কদন ফদ ফদ মট খ মট খ েদক েদক " " কভ কভ " দ ই দ ই ফদ ফদ য় আদ য় আদ আদছ আদছ নয় টভশর নয় টভশর আদছ আদছ । মদকন ফ েদক ফ েদক ভ একট ভ একট ভ ভ প প ু ু দ ভদক দ ভদক ফদ ফদ দফ কন দফ কন ফদ ফদ টক টক আদছ আদছ । টকবদফ ভধন ভধন কযদফ কযদফ ? টনদজয বলয় টনদজয বলয় টদখ টদখ । (There are 3 boxes, one box contains apple, one contains orange and another contains mixture of two. The boxes have wrong labels. So if a box is labeled “orange” you are sure that this box contains either apple or mixture. Now you can pick exactly one fruit from any basket to determine which box contains which fruit. Write the solution in your own language) [20]
Question 4:
ভয কদছ ভয কদছ ১১, ৩, ৫, ১০ এফা ৫০ এফা ৫০ কয কয কদয়ন কদয়ন আদছ আদছ , ট কদয়ন কদয়ন মফয ই মফয ই ফফয কযদ ফফয কযদ দয দয । ু টভ মট মট ফিদদয় কভ াখক কদয়ন কদয়ন ফফয কদয ফফয কদয ১২ ফনদ ১২ ফনদ ি ও দ ি ও দ ভয ভয ৩ কদয়ন কদয়ন গদফ এফা গদফ এফা ৩ ৩ কদয়ন কদয়ন টদয় টদয় ১২ ফনদনয এক উয় দ উয় দ ১ ১ কয কদয়ন কয কদয়ন এফা এফা এক এক ১০কয ১০কয কদয়ন কদয়ন ফফয কয ফফয কয (১*২+১০*১=১২)। এখন টনিদয দয উতয ও উতয ও। (You have some coins of value 1, 3, 5, 10 and 50 taka. You can use each coin as many time as you like. If you want to make 12 using minimum number of coin you need 3 coins and a way to make 12 using 3 coins is take two 1 taka coin and one 10 taka coin(1*2+10*1=12). Now answer following questions.) A. নূ নভ কয় কদয়ন কদয়ন যকয যকয ৮ ক ফনদ ফনদ ? (State the minimum number of coins needed to make 8 taka) [4] B. নূনভাখক কদয়ন কদয়ন ফফয কদয ফফয কদয
১২৯ ক ১২৯ ক ফনদনয এক উয় উয় খও। (Show a way to make
129 taka using minimum number of coins) [6] C.
মদকন X টযভর ক ক ফনদ ফনদ দ দ নূ নূ নভ কদয়ন াখ ফয াখ ফয কযয কযয এক ট এক ট ফদ ফদ ।
general way to make X taka using minimum number of coins) [10]
(State a
Question 5:
ছটফদ আয়দদয ট আয়দদয ট a এয ঘ েমদভ ৫ েমদভ ৫ এফা ৩ এফা ৩। ফদ দফ দফ দফ দফ ফৃ ফৃ তটয প ক ক ? a এফা b b এয ঘ (In the picture the two sides of the rectangles are a and b. Find the area of the circle) [pi=3.1416, ফৃ দতয প (area (area of circle)=pi*(r 2) ] [20]
Question 6:
টনিদয ছটফদ টনিদয ছটফদ ফৃ ফৃ তদ দ এদকক দ এদকক য আয য আয ীযিটহদ ীযিটহদ দ এক দ এক য য েদক আদযকটদ আদযকটদ মফয যস মফয যস । (In the picture the circles represent towns and arrows are roads between two towns.)
A. য A েদক য C ক ক বদফ বদফ মওয় মওয় ময় ময়? (How many ways are there to go from town A
to town C?)
[4] B. য A য েদক B B ক ক বদফ বদফ মওয় মওয় ময় ময়? (How many ways are there to go from town A to town B?) [6] C. ফদ ে ফদ ে এক এক এক এক কদয ন কদয ন দর দর টকবদফ টকবদফ উদযয উদযয ট ট ভধন ভধন কয কয ময় ময়? (How to solve the above questions without counting all the paths one by one?) [10]
Question 7:
ভয কদছ ভয কদছ এক এক ওয় ওয় গযভ গযভ কড়ই কড়ই আদছ। কড়ইদ আদছ। কড়ইদ ু ু টভ ভছ ভছ বজদ বজদ ি । কড়ইদ ি । কড়ইদ একেদ একেদ ভছ বজ বজ ময়। ভদছয ময়। ভদছয এক টঠ টঠ বজদ ১ বজদ ১ টভটন ভয় দগ। ভয় দগ। এখন ভদক এখন ভদক মট মট N ভছ য় ভছ য় েদক েদক , দ নূ নভ ক ক ভদয় ু ভদয় ু টভ ফদ ফদ ভছ ভছ বজদ যদফ বজদ যদফ ?একট ভছ ু দযু টয বজদ দ দ য ই টঠই টঠই বজদ দফ। (You have a frying pan for preparing some fishes. You can fry at most 10 fishes at a time. You also need 1 minute to fry one side of a fish. If you have N fishes, determine the minimum time you would require to fry all of them? In order to completely fry a fish, you need to fry both its side.) A. ধযন ূ ূট টখ। টখ। (Write (Write the general formula) [10] B. উতয টখ উতয টখ , মখন N = 4 (Give the answer when N = 4) [4] C. উতয টখ উতয টখ , মখন N = 10 (Give the answer when N = 10) [6]