In the game, Deliv-e-droid, a robot droid has to deliver packages while avoiding obstacles. At the end of the game, the final score is calculated based on the following point system:
Gain 50 points for every package delivered.
Lose 10 points for every collision with an obstacle.
Earn a bonus 500 points if the number of packages delivered is greater than the number of collisions with obstacles.
Your job is to determine the final score at the end of a game.
The input will consist of two lines. The first line will contain a non-negative integer \(P\), representing the number of packages delivered. The second line will contain a non-negative integer \(C\), representing the number of collisions with obstacles.
The output will consist of a single integer \(F\), representing the final score.
5
2
730
There are 5 packages delivered, so \(5 \times 50=250\) points are gained. There are 2 collisions, so \(2 \times 10=20\) points are lost. Since \(5>2\), a bonus 500 points are earned. Therefore, the final score is \(250 - 20 + 500 =730\).
0
10
-100
There are 0 packages delivered, so \(0 \times 50=0\) points are gained. There are 10 collisions, so \(10 \times 10=100\) points are lost. Since \(0 \leq 10\), no bonus points are earned. Therefore, the final score is \(0 - 100 + 0 = -100\).
Ron is cooking chili using an assortment of peppers.
The spiciness of a pepper is measured in Scolville Heat Units (SHU). Ron’s chili is currently not spicy at all, but each time Ron adds a pepper, the total spiciness of the chili increases by the SHU value of that pepper.
The SHU values of the peppers available to Ron are shown in the following table:
Pepper Name | Scolville Heat Units |
---|---|
Poblano | 1500 |
Mirasol | 6000 |
Serrano | 15500 |
Cayenne | 40000 |
Thai | 75000 |
Habanero | 125000 |
Your job is to determine the total spiciness of Ron’s chili after he has finished adding peppers.
The first line of input will contain a positive integer \(N\), representing the number of peppers Ron adds to his chili. The next \(N\) lines will each contain the name of a pepper Ron has added. Each pepper name will exactly match a name that appears in the table above. Note that more than one pepper of the same name can be added.
The output will consist of a positive integer \(T\), representing the total spiciness of Ron’s chili.
4
Poblano
Cayenne
Thai
Poblano
118000
A Poblano pepper has an SHU value of \(1500\). A Cayenne pepper has an SHU value of \(40000\). A Thai pepper has an SHU value of \(75000\). The total spiciness of Ron’s chili is therefore \(1500 + 40000 + 75000 + 1500 = 118000\).
You are trying to schedule a special event on one of five possible days.
Your job is to determine on which day you should schedule the event, so that the largest number of interested people are able to attend.
The first line of input will contain a positive integer \(N\), representing the number of people
interested in attending your event. The next \(N\) lines will each contain one person’s
availability using one character for each of Day 1, Day 2, Day 3, Day 4,
and Day 5 (in that order). The character Y
means the person
is able to attend and a period (.
) means the person is not
able to attend.
The following table shows how the available 15 marks are distributed:
Marks | Description |
---|---|
6 | There will be exactly one day on which every person will be able to attend. |
6 | There will be exactly one day on which the largest number of people will be able to attend. |
3 | There might be more than one day on which the largest number of people will be able to attend. |
The output will consist of one line listing the day number(s) on which the largest number of interested people are able to attend.
If there is more than one day on which the largest number of people are able to attend, output all of these day numbers in increasing order and separated by commas (without spaces).
3
YY.Y.
...Y.
.YYY.
4
All three people are able to attend on Day 4, and they are not all available on any other day.
5
YY..Y
.YY.Y
.Y.Y.
.YY.Y
Y...Y
2,5
There is no day on which all five people are able to attend. Four people are able to attend on both Day 2 and Day 5.
Bocchi the Builder just finished constructing her latest project: a laneway consisting of two rows of white equilateral triangular tiles. However, at the last moment, disaster struck! She accidentally spilled black paint on some of the tiles. Now, some of the tiles are wet and the other tiles are dry. Bocchi must place warning tape around the perimeters of all wet areas. Can you help her determine how many metres of tape she needs?
The first triangular tile will point upwards. Each pair of adjacent tiles (that is, tiles that share a common side) will point in opposite directions. Each tile has a side length of 1 metre.
The first line of input will consist of one positive integer \(C\), representing the number of columns.
The next two lines will each consist of \(C\) integers separated by spaces. Each integer represents the colour of a tile along the laneway, with 1 indicating that the tile is black (wet) and 0 indicating that the tile is white (dry).
The following table shows how the available 15 marks are distributed:
Marks | Description | Bound |
---|---|---|
3 | The laneway is not very long, black tiles are never adjacent and the second row is fully white. | \(C \le 2\,000\) |
3 | The laneway is not very long, black tiles may be adjacent and the second row is fully white. | \(C \le 2\,000\) |
5 | The laneway is not very long, black tiles may be adjacent and may appear in the second row. | \(C \le 2\,000\) |
4 | The laneway may be very long, black tiles may be adjacent and may appear in the second row. | \(C \le 200\,000\) |
Output a single integer representing the length of tape Bocchi needs, in metres.
5
1 0 1 0 1
0 0 0 0 0
9
The tiles are painted as follows, creating three wet areas. Bocchi will need 9 metres of warning tape as shown in yellow.
7
0 0 1 1 0 1 0
0 0 1 0 1 0 0
11
The tiles are painted as follows, creating three wet areas. Bocchi will need 5 metres of warning tape to surround one area and 3 metres of warning tape to surround each of the other two areas as shown in yellow.
In the CCC Word Hunt, words are hidden in a grid of letters. The letters of a hidden word always appear in order on horizontal, vertical, or diagonal line segments in one of two ways. One way is for the letters of a word to appear on one line segment. The other way is for the letters of a word to appear on one line segment up to some letter and then on a second line segment that forms a right angle at this letter.
Given a grid of letters and a single word to search for, your job is to determine the number of times that particular word is hidden in the grid.
The first line of input will contain a string of distinct uppercase letters, \(W\), representing the word you are to search for in the grid. The length of \(W\) will be at least two. The second line of input will be an integer \(R~(1 \le R \le 100)\), where \(R\) is the number of rows in the grid. The third line of input will be an integer \(C~(1 \le C \le 100)\), where \(C\) is the number of columns in the grid.
The remaining input will provide the letters in the grid. It will consist of \(R\) lines, where each line contains \(C\) uppercase letters separated by single spaces.
The following table shows how the available 15 marks are distributed:
Marks | Word Placement |
---|---|
2 | On one horizontal line segment |
2 | On one horizontal or vertical line segment |
2 | On one horizontal, vertical, or diagonal line segment |
9 | On one line segment or two perpendicular line segments |
The output will consist of a single non-negative integer \(H\), representing the number of times the word is hidden in the grid.
MENU
5
7
F T R U B L K
P M N A X C U
A E R C N E O
M N E U A R M
M U N E M N S
3
The word MENU
is hidden three times in the grid. Once
horizontally, once vertically, and once diagonally as shown. Notice that a single letter can be used more than once.
NATURE
6
9
N A T S F E G Q N
S A I B M R H F A
C F T J C U C L T
K B H U P T A N U
D P R R R J D I R
I E E K M E G B E
4
The word NATURE
is hidden four times in the grid. Once
diagonally, once vertically, and twice on perpendicular line
segments.