You are on page 1of 4

1124 Celebrity Jeopardy

It's hard to construct a problem that's so easy that everyone will get it, yet still difficult enough to
be worthy of some respect. Usually, we err on one side or the other. How simple can a problem
really be?
Here, as in Celebrity Jepoardy, questions and answers are a bit confused, and, because the
participants are celebrities, there's a real need to make the challenges simple. Your program
needs to prepare a question to be solved -- an equation to be solved -- given the answer.
Specifically, you have to write a program which finds the simplest possible equation to be solved
given the answer, considering all possible equations using the standard mathematical symbols in
the usual manner. In this context, simplest can be defined unambiguously several different ways
leading to the same path of resolution. For now, find the equation whose transformation into the
desired answer requires the least effort.
For example, given the answer X = 2, you might create the equation 9 - X = 7. Alternately, you
could build the system X > 0; X^2 = 4. These may not be the simplest possible equations. Solving
these mind-scratchers might be hard for a celebrity.
Input
Each input line contains a solution in the form < symbol > = < value >
Output
For each input line, print the simplest system of equations which would to lead to the provided
solution, respecting the use of space exactly as in the input.
Sample Input
Y=3
X=9
Sample Output
Y=3
X=9

11172 Relational Operators


Some operators checks about the relationship between two values and these operators are called
relational operators. Given two numerical values your job is just to find out the relationship
between them that is (i) First one is greater than the second (ii) First one is less than the second
or (iii) First and second one is equal.
Input
First line of the input file is an integer t (t<15) which denotes how many sets of inputs are there.
Each of the next t lines contain two integers a and b (|a|,|b|<1000000001).
Output
For each line of input produce one line of output. This line contains any one of the relational
operators >, < or =, which indicates the relation that is appropriate for the given two numbers.
Sample Input
3
10 20
20 10
10 10
Problem-setter: Shahriar Manzoor

Output for Sample Input


<
>
=

11332 - Summing Digits


For a positive integer n, let f(n) denote the sum of the digits of n when represented in base 10. It
is easy to see that the sequence of numbers n, f(n), f(f(n)), f(f(f(n))), ... eventually
becomes a single digit number that repeats forever. Let this single digit be denoted g(n).
For example, consider n = 1234567892. Then:
f(n) = 1+2+3+4+5+6+7+8+9+2 = 47
f(f(n)) = 4+7 = 11
f(f(f(n))) = 1+1 = 2
Therefore, g(1234567892) = 2.
Each line of input contains a single positive integer n at most
2,000,000,000. For each such integer, you are to output a single line
containing g(n). Input is terminated by n = 0 which should not be
processed.
Sample input
2
11
47
1234567892
0
Output for sample input
2
2
2
2
Zachary Friggstad

11764 - Jumping Mario


Mario is in the final castle. He now needs to
jump over few walls and then enter the
Koopas Chamber where he has to defeat the
monster in order to save the princess. For this
problem, we are only concerned with the
jumping over the wall part. You will be given
the heights of N walls from left to right. Mario
is currently standing on the first wall. He has
to jump to the adjacent walls one after
another until he reaches the last one. That
means, he will make (N-1) jumps. A high
jumpis one where Mario has to jump to a taller wall, and similarly, a low jump is one where Mario
has to jump to a shorter wall. Can you find out the total number of high jumps and low
jumps Mario has to make?

Input
The first line of input is an integer T (T < 30) that indicates the number of test cases. Each case
starts with an integer N (0 < N < 50) that determines the number of walls. The next line gives the
height of the N walls from left to right. Each height is a positive integer not exceeding 10.

Output
For each case, output the case number followed by 2 integers, total high jumps and total low
jumps, respectively. Look at the sample for exact format.

Sample Input

Output for Sample Input

3
8
14223534
1
9
5
12345

Case 1: 4 2
Case 2: 0 0
Case 3: 4 0