You are on page 1of 10

Name : Aniruddha Hemant Bodhakar

School/College name : Prabhat Kids School

Class/Year of Study :9th Standard

Registered Email
address:hemantbodhakar80@gmail.com

Mode of S.T.E.M.S. Registration: By School

Q. No. A B C D
1
2
3
4
5
6
7
8
9
10
SUBJECTIVE QUESTIONS

Q. No. 1

Consider strings made up only of the


characters 00and 11; these are binary strings. A
binary palindrome is a palindrome that is also a
binary string.
(a)Let f(n)f(n) be the number of binary palindromes
of length 2n2n, for n≥0n≥0. Discover a formula
for f(n)f(n). Here are two pairs to get you
started: f(0)=1f(0)=1, f(1)=2f(1)=2, ……. (Notice that
we are concerned only with even-length binary
palindromes.)
(b)Prove that your formula is correct for all n≥0n≥0,
using simple induction.
I get that the formula would be f(n)=2nf(n)=2n, but
I'm having difficulty proving this. I am new to
induction, so I am unsure where to begin. Any help
would be appreciated :)
Two methods:
Direct Approach: To make a palindrome of
length 2n2n we may choose the first nnhowever we
like, then repeat the string backwards. But there
are 22 ways to choose the first character, 22 ways to
choose the second, up to 22 ways to choose
the nthnth so there
are 2∗2∗…∗2=2n2∗2∗…∗2=2n ways to do it.
Induction: It is easy to verify the formula for
small nn (but you should be sure to do it!). Assume we
have done it for n−1n−1. Thus we know there
are 2n−12n−1 palindromic strings of
length 2(n−1)2(n−1). Now, to make a palindromic
string of lenght 2n2n we choose one of
length 2(n−1)2(n−1) and select a character
(either 11 or 00) to surround it (one in front, one at the
end). There are, by induction, 2n−12n−1 ways to
choose the string of length 2(n−1)2(n−1) and 22 ways
to choose the surrounding character so all in all there
are 2∗2n−1=2n2∗2n−1=2n ways to make our string of
length 2n2n, as desired.

Assume that n is 1 to 9
Therefore,
1!-1=0
2!-1=1
3!-1=5
4!-1=24-1=23+32=55
5!-1=120-1=119+911=1030+301=1331
6!-1=720-1=719+917=1636+6361=7997
7!-1=5040-1=5039+9305=14344+44311=58685
8!-1=40320-1=40319+91304=131623+326131=45774.
Etc
Q. No. 2.

As it is said that,
Debjit lists down the name of all the students of class IX B on 52
different bits of paper,
folds all of them neatly and hands them over to Agnishom. (All
bits of paper look alike and
are of equal size). Now Debjit asks Agnishom to randomly pick
any 5 bits of paper from
the lot. Agnishom is allowed to inspect and shuffle the bits of
paper well before picking any
five. He picks out 5 bits and then hands them to Debjit (Ashwin
can’t see any of this).
Debjit inspects at the bits and picks 1 bit out and gives it back to
Agnishom. Debjit then
arranges the other four bits in a special way, and give those 4
bits, all folded, and in a neat
pile, to Ashwin.
Ashwin inspects at the 4 bits Debjit gave him, and says out loud,
the name of the student on the bit which Agnishom is holding.
Here Showing will say the detailed process which they have done
here and surprisingly the name called by
Ashwin is Agnihoshans name.

Q. No. 3.

There are N cities in a Kingdom. Since road


infrastructure is not so good, some of the cities are not
connected via roads. Now the King is interested in
upgrading road infrastructure to such an extent that
people can use roadways to travel anywhere in the
Kingdom (i.e. road travel is possible between each pair
of cities).Following King's initiative, minister cabinet
has come up with cost matrix C (the road building cost
from city i to city j, details are in input format). You
need to print the minimum cost incurred to fulfill the
initiative. It is always possible to make the kingdom
road connected with given plan.
Note: All roads are bidirectional.
Input:
The first line contains T – the number of test cases.
First line of each test case contains two integers N –
the number of cities and M –the number of existing
roads.
Next M lines contain city id pairs u and v (1 - based
indexed) for existing roads between cities.
Next line contains a single integer K – the number of
additional roads that can be built. K lines follow.
Each of these K lines consists of three space
separated integers – u, v and c denoting a road
between cities u and v with cost c.
1 <= T <= 10
1 <= N <= 10000
1 <= K+M <= 1000000
1 <= C <= 1000000
1 <= u, v <= N
Output:
Print the minimum cost incurred to connect cities in a
way such that there exists a path between every two
cities.
SAMPLE INPUT

2
4 2
1 4
1 3
4
1 2 16
2 3 15
3 4 4
2 4 15
4 1
2 4
4
1 3 7
2 3 1
1 2 8
1 4 4
SAMPLE OUTPUT

15
5

Explanation
For first test case -
There are already roads between cities 1 - 4 and 1 - 3.
Thus cities 1, 3 and 4 are connected. Now we need to
connect city 2 with any of them to make a connected
Kingdom. The minimum cost of the road that connects
to city 2 is 15.
Time Limit:2.0 sec(s) for each input file.
Memory Limit:256 MB
Source Limit:1024 KB
Marking Scheme:Marks are awarded when all the
testcases pass.
Allowed Languages:Bash, C, C++, C++14, Clojure,
C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8,
JavaScript(Rhino), JavaScript(Node.js), TypeScript,
Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C,
OCaml, Octave, Pascal, Perl, PHP, Python, Python 3,
R(RScript), Racket, Ruby, Rust, Scala, Swift, Swift-4.1,
Visual Basic

As in the city of constellations there is no city cycles but if and only


city cycles of length 3.

Q. No. 4
A positive integer p is a prime if the only divisors of
p are 1 and p. If p
k
| a and p
k+1 - a where p is a prime, i.e. p
k
is the highest
power of p dividing a, then we denote this by p
kka.
Useful Facts
• If a, b > 0, and a | b, then a ≤ b.
• If a | b1, a | b2, . . . , a | bn, then for any integers c1, c2, . . . , cn,
a|
Xn
i=1
bici

You might also like