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

# OVERNITE MAINS

PROBLEM :1
There are 3 kinds of money in a planet far away from the earth: Mone, Luck, and Rpin. There's a money exchange company in this planet. You must go to this company if you want some money exchange, and, more autocratically, this company regulate the to do exchange pair of these 3 kinds of money. rate of each The money exchange will be done in the following two ways: (A) You give the company a real x in the range (0,100], the company will number Mone and exchange of your x % of your Luck to equal Rpin according to the exchange rate of that day. (B) You give the company a real x , the company will exchange number your according to the exchange rate of that day, Mone and Luck, whose value is equal x Rpin to the value of Mone is and, Rate times of the value of Luck. You can do many exchange operations in the same day. Now, as the excellant spy in this planet, you know the exchange rate between Mone and of each of the next Rpin n days(a i Mone per Rpin), and the exchange rate between Luck and Rpin of each of the next n days(b n days( Rate i Luck per Rpin), and, each Rate of the next you S Rpin in the start, and you want to get most Rpin in n th day have the later. x Rpin to some x%

i ).

Input:

Multiple test cases, the number of them( <=5 ) is given in the very first line.

For each test case: The first line contains a integer number n(1<=n<=100000) and a real number S.n lines each contains 3 real numbers: a follow, (between 0 and 10), b i Rate i (between 0 and 100).

## (between 0 and 10),

Output:

For each test case, output one line contains a real number with 3 digits after decimal point, which denotes to the answer. You can assume it is less than 1000000000.

Exampl e
Input : 1 3 100 111 122 223 Output : 25.000 2

PROBLEM DIFFERENT

2.

ALL

## Input: 1. Enter the size of grid.

2. Enter the number of coins. Output: Find the distance between the coins and it must be different and efficient

Problem 3
Create a program that takes in a wordsearch board, and list of words and finds the location of all the words hidden.

Input:
Input consists of 50 lines of 50 characters each (all uppercase), this is the game board. Following it, untill the end of file is the list of words that are hidden in the board.

Output:
Output consists of you printing the board back out to the screen, with all the characters not part of a hidden word removed and replaced with a that were space. ex. input:
Quote
word: "the" board: TJK BHQ ERE

ex. output
T H E

PROBLEM : 4 N large empty boxes (assume they are of type:1) are initially placed on a table. An unknown number of boxes (type:1) are selected and in each of them K smaller boxes (type:2) are placed. Again an unknown number of type:2 boxes are selected and K boxes of type:3 are placed inside. This process is repeated T times. Now a box is assumed to be empty when it has no smaller boxes inside it. Finally after all the processes are complete let be there Fempty boxes in total.

LIMIT S
1< N,K,T,F <1000000

Input
First line of the input file contains the number of test cases. Then each line contains 4 integers N,K,T,F as described above.

Output
Each line should contain the total number of boxes on the table.

Exampl e
Input : 1 11 8 2 102 Output : 15 1

Problem 5
The Sarcophagus itself is locked by a secret numerical code. When somebody wants to open must know the code and set it exactly on the top of the Sarcophagus. A very it, he intricate mechanism then opens the cover. If an incorrect code is entered, the tickets inside wouldfire immediately and they would have been lost forever. The code (consisting of up catch to integers) was hidden in the Alexandrian Library but unfortunately, as you probably 100 know, the completely. library burned down

But an almost unknown archaeologist has obtained a copy of the code something during the century. He was afraid that the code could get to the wrong people'' so he has 18th encoded the numbers in a very special way. He took a random complex number (in absolute value) than any of the encoded numbers. Then he counted the numbers as the digits of the system with basis B . That means the sequence numbers ..., a 1 , a 0 was encoded as the number X = a 0 + a 1 B + a 2 B2 + ...+ a Your goal is to decrypt the secret code, i.e. to express a given number system to the base B . In other words, given the thedigit'' a 0 throug a n numbers . h

n

Bn

a n , a n- 1 ,

X and

## X in the number B you are to determine

Input
The input consists T test cases (equal to about 100000). The number of them ( T ) is given of the first line of the input file. Each test case consists of one single line containing on four integer X r , X i , B r , B i ( | r |,| i | <= 1000000 , | r |,| i | <= 16 ). These numbers numbers the real and complex componentsX of X B and B B, i.e. X = X indicate X r + i.X i , B = B r+ numbersis the basis of the system ( i. i . B |B| > 1 ), X is the number you have to B express.

Output
Your program must output a single line for each test case. The line should contain the digits'' a n , a n- 1 , ..., a 1 , a 0 , separated by commas. The following conditions must be satisfied: for all X=a iin {0, 1, 2, ...n} : 0 <= a + a 1 B + a 2 B 2 + ...+ a Bn 0 n a n <> 0 < | B|

## if n > 0 then n <= 100

If there are no numbers meeting these criteria, output the sentence " decrypted. ". If there are more possibilities, print any of them.

## The code cannot be

Exampl e
Sample Input 4 -935 2475 -11 -15 1 0 -3 -2 93 16 3 2

191 -192 11 -12 Sample output: 8,11,18 1 The code decrypted. 16,15

cannot

be

Problem 6
You are given a list of cities. Each direct connection between two cities has its transportation cost (an integer bigger than 0). The goal is to find the paths of minimum cost between pairs of cities. Assume that the cost of each path (which is the sum of costs of all direct connections belongning to this path) is at most 200000. The name of a city is a string containing characters a,...,z and is at most 10 characters long.

Input
s [the number of tests <= 10] n [the number of cities <= 10000] NAME[city p [the name] of neighbours of number NAME] citycost [ nr - index of a city connected to nr NAME(the index of the first city is 1)] [ cost - the transportation cost] r [the number of paths to find <= 100 ] NAME1 NAME2 [ NAME1 - source, NAME2 - destination] [empty line separating the tests]

Output
cost [the minimum transportation cost from line)] city NAME1 to city NAME2 (one per

Exampl e
Input : 1 4 gdansk 2 21 33 bydgoszc z 3 11 31 44 torun 3 13

## 21 41 warszawa 2 24 31 2 gdansk warszawa bydgoszcz warszawa Output : 3 2

Problem 7
On a rectangular mesh n*m fields, n*m cuboids were put, one cuboid on each comprising field. A base of each cuboid covers one field and its surface equals to one square inch. Cuboids on adjacent fields adhere one to another so close that there are no gaps between them. A heavy rain pelted on a construction so that in some areas puddles of water appeared.

Write which: a program

reads from the standard input a size of the chessboard and heights of cuboids put on the fields, computes maximal water volume, which may gather in puddles after the rain, writes results in the standard output.

Input
The number of test cases t is in the first line of input, then t test cases follow separated by an empty line. In the first line of each test case two positive integers 1 <= m <= 100 are written. They are the size of the mesh. In each of the <= following integers from the interval [1..10000]; there are m i -th number in of a cuboid given in inches put on the field in the i-th and chessboard.

n <= 100, 1 n lines j -th line denotes a height column j-th raw of the

Output
Your program should write for each tes case one integer equal to the maximal volume of water (given in cubic inches), which may gather in puddles on the construction.

Exampl e
Sample input: 1 36 334442 313214

731641 Sample output: 5 The picture below shows the mesh after the rain (seen from above). Puddles are drawn in gray.