There is a new conveyor belt sushi restaurant in town. Plates of sushi travel around the restaurant on a raised conveyor belt and customers choose what to eat by removing plates.
Each red plate of sushi costs
Your job is to determine the cost of a meal, given the number of plates of each colour chosen by a customer.
The first line of input contains a non-negative integer,
Output the non-negative integer,
0
2
4
28
This customer chose
Dusa eats Yobis, but only Yobis of a certain size.
If Dusa encounters a Yobi that is smaller than itself, it eats the
Yobi, and absorbs its size. For example, if Dusa is of size
If Dusa encounters a Yobi that is the same size as itself or larger, Dusa runs away without eating the Yobi.
Dusa is currently facing a line of Yobis and will encounter them in order. Dusa is guaranteed to eventually encounter a Yobi that causes it to run away. Your job is to determine Dusa’s size when this happens.
The first line of input contains a positive integer,
The remaining lines of input contain positive integers representing the sizes of the Yobis in order.
Output the positive integer,
5
3
2
9
20
22
14
19
Dusa is large enough to eat the Yobi of size
10
10
3
5
10
The Yobi of size
After completing a competition, you are struck with curiosity. How many participants were awarded bronze level?
Gold level is awarded to all participants who achieve the highest score. Silver level is awarded to all participants who achieve the second highest score. Bronze level is awarded to all participants who achieve the third highest score.
Given a list of all the scores, your job is to determine the score required for bronze level and how many participants achieved this score.
The first line of input contains a positive integer,
Each of the next
Each score is between
The following table shows how the available
Marks | Description | Bound |
---|---|---|
The scores are distinct and the number of participants is small. | ||
The scores might not be distinct and the number of participants is small. | ||
The scores might not be distinct and the number of participants could be large. |
Output a non-negative integer,
4
70
62
58
73
62 1
The score required for bronze level is
8
75
70
60
70
70
60
75
70
60 2
The score required for bronze level is
As Alex is typing, their keyboard is acting strangely. Two letter keys are causing trouble:
One letter key displays the same wrong letter each time it is pressed. Alex calls this key the silly key. Oddly, Alex never actually tries to type the wrong letter displayed by the silly key.
Another letter key doesn’t display anything when it is pressed. Alex calls this key the quiet key.
Alex presses the silly key at least once but they don’t necessarily press the quiet key.
Your job is to determine the troublesome keys and the wrong letter that is displayed. Luckily, this is possible because Alex never presses the silly key immediately after pressing the quiet key and Alex never presses the quiet key immediately after pressing the silly key.
There will be two lines of input. The first line of input represents
the
Both lines of input will only contain lowercase letters of the alphabet.
The following table shows how the available
Marks | Description | Bound |
---|---|---|
The quiet key is not pressed. A small number of keys are pressed. | ||
The first troublesome key pressed is the silly key. A small number of keys are pressed. | ||
The first troublesome key pressed may be the silly key or the quiet key. A small number of keys are pressed. | ||
4 | The first troublesome key pressed may be the silly key or the quiet key. A large number of keys are pressed. |
There will be two lines of output.
On the first line, output the letter corresponding to the silly key and the wrong letter displayed on the screen when it is pressed, separated by a single space.
On the second line, output the letter corresponding to the quiet key
if it is pressed. Output the dash character (-
) if the
quiet key is not pressed.
forloops
fxrlxxps
o x
-
The letter corresponding to the silly key was the letter
o
. Each time it was pressed, the wrong letter
x
was displayed. The quiet key was not pressed.
forloops
fxrlxxp
o x
s
The letter corresponding to the silly key was the letter
o
. Each time it was pressed, the wrong letter
x
was displayed. The quiet key corresponds to the letter
s
which was not displayed.
forloops
frlpz
s z
o
The letter corresponding to the silly key was the letter
s
. Each time it was pressed, the wrong letter
z
was displayed. The quiet key corresponds to the letter
o
which was not displayed.
There is a wildly popular new harvest simulation game called Harvest Waterloo. The game is played on a rectangular pumpkin patch which contains bales of hay and pumpkins of different sizes. To begin the game, a farmer is placed at the location of a pumpkin.
The farmer harvests all pumpkins they can reach by moving left, right, up, and down throughout the patch. The farmer cannot move diagonally. The farmer can also not move through a bale of hay nor move outside of the patch.
Your job is to determine the total value of all the pumpkins
harvested by the farmer. A small pumpkin is worth
The first line of input is an integer
The second line of input is an integer
The next S
for a small pumpkin, M
for a
medium pumpkin, L
for a large pumpkin, or *
for a bale of hay.
The next line of input is an integer
The following table shows how the available
Marks | Description | Bound |
---|---|---|
The patch is small and there are no bales of hay. | ||
The patch is small and the bales of hay divide the entire patch into rectangular areas. | ||
The patch is small and the bales of hay can be anywhere. | ||
The patch is large and the bales of hay can be anywhere. |
Output the integer,
6
6
**LMLS
S*LMMS
S*SMSM
******
LLM*MS
SSL*SS
5
1
37
Starting at row 5 and column 1, the farmer can reach the 6 pumpkins
in the highlighted area. They harvest 2 small pumpkins, 1 medium
pumpkin, and 3 large pumpkins. The total value in dollars of this
harvest is
6
6
**LMLS
S*LMMS
S*SMSM
***SLL
LLM*MS
SSL*SS
2
4
88
Starting at row