| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 1030 | Maximum Sum (II) |
|
| 1031 | sqrt log sin |
|
| 1032 | Lotto |
|
| 1033 | What goes up? |
|
| 1034 | Products |
|
Description
In a given a sequence of non-negative integers you will have to find such a sub-sequence in it whose summation is maximum.
Input
The input file contains several input sets. The description of each set is given below:
Each set starts with an integer N (N<1000) that indicates how many numbers are in that set. Each of the next N lines contains a single non-negative integer. All these numbers are less than 10000.
Input is terminated by a set where N=0. This set should not be processed.
Output
For each set of input produce one line of output. This line contains one or more integers which is are taken from the input sequence and whose summation is maximum. If there is more than one such sub-sequence print the one that has minimum length. If there is more than one sub-sequence of minimum length, output the one that occurs first in the given sequence of numbers. A valid sub-sequence must have a single number in it. Two consecutive numbers in the output are separated by a single space.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
An evil professor has just assigned you the following problem.
A sequence is defined by the following recurrence:

Determine x1000000.
Input
Input consists of a number of lines, each containing one integer, a value of i, no less than zero and no greater than one million. Input is followed by a single line containing the integer -1. This last line is not a value of i and should not be processed.
Output
For each value of i in the input (but not the final -1), output the corresponding value of xi modulo 1000000.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
In the German Lotto you have to select 6 numbers from the set {1,2,...,49}.
A popular strategy to play Lotto - although it doesn't increase your chance of winning - is to select a subset S containing k (k>6) of these 49 numbers, and then play several games with choosing numbers only from S.
For example, for k=8 and S = 1,2,3,5,8,13,21,34 there are 28 possible games: [1,2,3,5,8,13], [1,2,3,5,8,21], [1,2,3,5,8,34], [1,2,3,5,13,21], ..., [3,5,8,13,21,34].
Your job is to write a program that reads in the number k and the set S and then prints all possible games choosing numbers only from S.
Input
The input file will contain one or more test cases.
Each test case consists of one line containing several integers separated from each other by spaces. The first integer on the line will be the number k (6 < k < 13). Then k integers, specifying the set S, will follow in ascending order.
Input will be terminated by a value of zero (0) for k.
Output
For each test case, print all possible games, each game on one line.
The numbers of each game have to be sorted in ascending order and separated from each other by exactly one space. The games themselves have to be sorted lexicographically, that means sorted by the lowest number first, then by the second lowest and so on, as demonstrated in the sample output below.
The test cases have to be separated from each other by exactly one blank line. Do not put a blank line after the last test case.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Write a program that will select the longest strictly increasing subsequence from a sequence of integers.
Input
The input file will contain a sequence of integers (positive, negative, and/or zero). Each line of the input file will contain one integer.
Output
The output for this program will be a line indicating the length of the longest subsequence, a newline, a dash character ('-'), a newline, and then the subsequence itself printed with one integer per line. If the input contains more than one longest subsequence, the output file should print the one that occurs last in the input file.
Notice that the second 8 was not included -- the subsequence must be strictly increasing.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
The problem is to multiply two integers X, Y. (0<=X,Y<10250)
Input
The input will consist of a set of pairs of lines. Each line in pair contains one multiplyer.
Output
For each input pair of lines the output line should consist one integer the product.