Professional Documents
Culture Documents
ISTE Week Overnight Coding
ISTE Week Overnight Coding
ISTE Week Overnight Coding
ISTE WEEK
OVERNIGHT PROGRAMMING
CONTEST
RULES:
Scoring:
Problem 1
The Light Warrior techies have just finished
developing ‘The Obliterator’, a massive laser
that destroys anything that comes in its path.
However the amount of energy it uses is too
large (even for the light warriors who are a
gazillion light years ahead of us!!!). Hence the
narrower the beam, the lesser the energy used and more focussed the
destruction. Their scouts have just found several planet systems of the
Dark Dominators. The Light Warriors firstly plan to make the width of the
beam so narrow that the only way to destroy the system is to align it in
such a way that the beam lies in the plane defined by the planets in the
system. Secondly, they make the width so small in length that nothing
bigger than the particular system can be covered by it. Finally, they take
‘The Obliterator’ to a strategic position close to the system, orient it in a
way such that the beam lies in the system's plane and then fire it towards
the constellation in a straight line until the whole system is obliterated.
You are required to calculate the minimum width of the beam that will
destroy the system given the location of the planets within that system.
Input Format Sample Input
<The number of testcases representing the number of systems> 1
<number of points in the 1st testcase or system> 5
<x1 y1> 20
<x2 y2> 02
. 00
<xn yn> 11
ISTE Week 3
Overnite Programming Contest
. 22
<number of points in the nth testcase or system> Sample Output
. 2.000
<x1 y1>
<x2 y2>
.
<xm ym>
Output Format
<Length 1 upto 3 decimal places>
<Length2 upto 3 decimal places>
.
<Length n upto 3 decimal places>
ISTE Week 4
Overnite Programming Contest
Problem 2
The Light Warrior battle ships used to fight on
planets are very energy efficient. During
daytime, they run on solar energy but at
N night they use fusion candles, candles which
UCL burn and release large amounts of energy to
EAR drive the ship. Thus each candle acts as a
CAN mini battery. Every ship takes a limited
DLE number of candles with it before
S disembarking from the mothership and going
into war. On the first night of the journey,
they will light one candle. At the end of the
night, they will extinguish the candle. On
each subsequent night, they need to light one more candle than they did
on the previous night, so that on the nth night (indexed from 1) they will
light n candles (and extinguish them all when they find the sun in the
morning). Each night that they light a candle, its height decreases by 1
cm; once its height reaches 0 cm, they cannot use it anymore. You need
to tell them the maximum number of nights a ship will last without
returning to the mothership for refuelling. You are given a int[] candles,
the ith element of which is the height of the ith candle that you own.
For example, if you have three candles of height 2, you can light one the
first night, the other two on the second night, and then all three candles
on the third night.
Input Format:
.
ISTE Week 5
Overnite Programming Contest
Output Format:
<An integer showing the maximum number of days the candles will last for test case
1>
<An integer showing the maximum number of days the candles will last for test case
2>
<An integer showing the maximum number of days the candles will last for test case
k>
1 3
3
2
2
ISTE Week 6
Overnite Programming Contest
Problem 3
The Light Warriors’ hacker (which is you by
the way) has just hacked into the Dark
Dominators’ computer base, and you want to
delete one of the operational files. But wait,
why not make the Dark Dominators delete it
themselves! As you keep watching them, you
learn that they have a delete command typed
in on their terminal which contains a 'pattern'.
You want to rename the operational file to
match this pattern so that it gets deleted
once they issue the command. You must
accomplish this by renaming the given file to a similar name. Other than
lowercase letters, a pattern might contain '?' which represents exactly
one character (so "a?b" matches "aab", "abb", "acb" etc).
A move is defined as adding a character, deleting a character, or
modifying a character from the 'filename'. Given two Strings, 'filename'
and 'pattern', display the minimal number of moves required to make the
file match the pattern.
Input Format: Sample Input :
<An integer giving the minimum number of moves required for test case 1>
<An integer giving the minimum number of moves required for test case 2>
.
ISTE Week 7
Overnite Programming Contest
<An integer giving the minimum number of moves required for test case n>
Problem 4
Oh Oh! Looks like the Dark Dominators have
just found out the location of the Abode of
Light, the home system o the Light Warriors.
It’s time to pull up the defences and prepare for
battle before the darkness reaches the base.
The Light Warriors use a highly advanced shield
system that does not allow anything to
penetrate through it. However it needs to be
set up in a rather primitive manner. It consists of two mobile generators
that need to be placed very strategically in the system, for the shield is
actually an impenetrable sphere created using the distance between the
two mobile generators as its diameter. You will be provided with a map of
the home system (not more than 10X10) where ‘a’ represents the location
of a planet and ‘-’ shows empty space in between the planets. You need
to select two planets in the system where the generators will be placed so
that the shield generated encloses all other planets in the system. Mark
the selected planets with ‘@’ and return the map with the changes. Take
the map as a 2D character matrix.
Input Format Sample Input:
Sample Output:
. a---- ---
@-
. ---a-
<nth line of the map>
Output Format
Problem 5:
Victory seemed eminent, but the power of the ring could not be
undone.
Output Format:
Problem 6
It is time. The titans are set to clash.
The end has begun. Due to your
help, the Light Warriors have
successfully vanquished the forces of
evil from most parts of the universe.
The Dark Dominators have now been
pinned down in the Valley of
Darkness, their home system. It’s
time to exterminate the exceedingly
evil and ever evolving forces of darkness and enrich the universe with the
essence of excellence, energising , enlightening and exalting all from the
extremities of lowness to the highest echelons of existence( the Light
Warriors have a thing for the letter ‘e’ ).
Now all that the Light Warriors need to do is to take ‘The Obliterator’
there and blow everything to smithereens. However in response to ‘The
Obliterator’ the Dark Dominators have finally built ‘The Drain’ which is a
series of mines so small that they are virtually untraceable but so
powerful that a single mine can devastate ‘The Obliterator’. Thus they
need a sweeping operation before they can move their master weapon
into position.
It’s a well known fact that the Dominators are crazy after prime numbers.
So much so that most of their childhood is spent trying to calculate the
biggest primes instead of playing ‘Hop Scotch’ or ‘Let’s kill the Light
Warriors!!!’. A faithful informant has just revealed that the number of
mines hidden in a particular sector of space is the same as the number of
circular primes below the particular sector number. The number 197 is
called a circular prime because all rotations of the digits: 197, 971, and
719, are themselves prime. There are thirteen such primes below 100: 2,
3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97. Hence sector 100 has 13
mines hidden within it.
Given a sector number, find out the number of circular primes below that
number to help the Light Warriors quickly sweep out all the mines and
ISTE Week 11
Overnite Programming Contest
approach the Valley of Darkness safely, so that they can obliterate all the
remaining scum of the universe from the very shred of existence.
Input Format:
Output Format:
<An integer giving the number of circular primes found below the sector number for testcase 1>
<An integer giving the number of circular primes found below the sector number for testcase
2>
.
.
<An integer giving the number of circular primes found below the sector number for testcase
n>
1 13
100
ISTE Week 12
Overnite Programming Contest