You are on page 1of 3

CODEMASTERS

RULES1. It is an online C++ coding event. 2. The questions will be put up at 10:00 am and you will have to mail

the solution to the same email-id (admin@ieencmanipal.in) by 2:00 PM on 4th March 2011 with your name, event name, delegate card number or your receipt number as the subject. 3. The decision of the organizing committee will be final and binding. 4. Results will be declared on a later date.

QUESTION 1- DNA sequences of most of the primates match. The DNA sequence can be represented by a sequence of letters. You have to write a program that takes n primates DNA sequences as input and identify the sequence that is common in more that 65% of the primates. One DNA sequence can contain a maximum of 100 letters. Output the longest string or strings shared by more than 65% of the primates. If there are many, output all of them in alphabetical order. If there is no solution with at least one letter, output "?". Leave an empty line between test cases. Sample Input 3 abcdefg bcdefgh cdefghi 3 xxx yyy zzz 0 Output for Sample Input bcdefg cdefgh

QUESTION 2- In a game of gambling a player starts with Rs.1, and bets for n rounds. For each round, he may

Quit and keep his winnings. If he decides to bet and doesnt win, he quits with nothing. If he wins, the prize is doubled, and he continues with the next bet.

After the last bet, he quits with his prize. The player wants to maximize his expected prize. Once each bet, the player is able to assess the probability p that he will be able to win it. For each bet, we assume that p is a random variable uniformly distributed over the range t1. Input is a number of lines, each with two numbers: an integer 1 n 30, and a real 0 t 1. Input is terminated by a line containing 0 0. This line should not be processed. For each input n and t, print the player's expected win, if he plays the best strategy. Output should be rounded to three fractional digits. Sample input 1 0.5 1 0.3 00 Output for sample input 1.500 1.357

QUESTION 3. An empty Tic Tac Toe grid can be easily represented with nine 0s. Whenever player A or B plays we fill in a 1 or a 2 in the appropriate position. The example below illustrates each grid configuration from the beginning to the end of a game in which A wins. 000 100 102 102 102 102 102 102 000 000 000 000 020 020 220 220 000 000 000 001 001 101 101 111 Write a C++ code to determine if it can be a part of a valid ongoing Tic Tac Toe game. The first line of input contains N, the number of test cases. Followed by N test cases of grids( may or not be completely filled). For each case print "yes" or "no" on a line by itself, indicating whether or not the configuration could be part of an ongoing Tic Tac Toe game.

Sample Input 1 102 220 111 Output for Sample Input yes

You might also like