A regular box of cupcakes holds 8 cupcakes, while a small box holds 3 cupcakes. There are 28 students in a class and a total of at least 28 cupcakes. Your job is to determine how many cupcakes will be left over if each student gets one cupcake.
The input consists of two lines.
The first line contains an integer
The second line contains an integer
Output the number of cupcakes that are left over.
2
5
3
The total number of cupcakes is
2
4
0
The total number of cupcakes is
Fergusonball players are given a star rating based on the number of
points that they score and the number of fouls that they commit.
Specifically, they are awarded
Your job is to determine how many players on a team have a star
rating greater than
The first line of input consists of a positive integer
Output the number of players that have a star rating greater than
3
12
4
10
3
9
1
3+
The image shows the star rating for each player. For example, the
star rating for the first player is
All three players have a rating
greater than
2
8
0
12
1
1
The image shows the star rating for each player.
Since only one of
the two players has a rating greater than
The CCC harp is a stringed instrument with strings labelled A,B,...,T. Like other instruments, it can be out of tune.
A musically inclined computer science student has written a clever computer program to help tune the harp. The program analyzes the sounds produced by the harp and provides instructions to fix each string that is out of tune. Each instruction includes a group of strings, whether they should be tightened or loosened, and by how many turns.
Unfortunately, the output of the program is not very user friendly.
It outputs all the tuning instructions on a single line. For example,
the single line AFB+8HC-4
actually contains
two tuning instructions: AFB+8
and
HC-4
. The first instruction indicates that
harp strings A, F, and B should be tightened 8 turns, and the
second instruction indicates that harp strings H and C should be loosened 4 turns.
Your job is to take a single line of tuning instructions and make them easier to read.
There will be one line of input which is a sequence of tuning
instructions. Each tuning instruction will be a sequence of uppercase
letters, followed by a plus sign (+
) or minus
sign (-
), followed by a positive integer.
There will be at least one instruction and at least one letter per
instruction. Also, each uppercase letter will appear at most once.
The following table shows how the available 15 marks are distributed.
Marks Awarded | Maximum Input Values | Example Input | ||
---|---|---|---|---|
Number of Instructions | Number of Letters in an Instruction | Number of Turns | ||
5 marks | 1 | 20 | 9 | AFB+8 |
5 marks | 20 | 1 | 9 | A+8H-4 |
3 marks | 20 | 20 | 9 | AFB+8HC-4 |
2 marks | 20 | 20 | 999 999 | AFB+88HC-444 |
There will be one line of output for each tuning instruction. Each
line of output will consist of three parts, each separated by a single
space: the uppercase letters referring to the strings,
tighten
if the instruction contained a plus
sign or loosen
if the instruction contained a
minus sign, and the number of turns.
AFB+8HC-4
AFB tighten
8 HC loosen 4
The input contains two tuning instructions:
AFB+8
and HC-4
.
AFB+8SC-4H-2GDPE+9
AFB tighten 8
SC loosen 4
H loosen 2
GDPE tighten 9
The input contains four tuning instructions:
AFB+8
, SC-4
,
H-2
, and GDPE+9
.
A class has been divided into groups of three. This division into groups might violate two types of constraints: some students must work together in the same group, and some students must work in separate groups.
Your job is to determine how many of the constraints are violated.
The first line will contain an integer
The next line will contain an integer
Among these
The next line will contain an integer
Each name will consist of between 1 and 10 uppercase letters. No two
students will have the same name and each name appearing in a constraint
will appear in exactly one of the
The following table shows how the available 15 marks are distributed at the Junior level.
Marks Awarded | Number of Groups | Number of Constraints |
---|---|---|
4 marks | ||
10 marks | ||
1 mark |
The following table shows how the available 15 marks are distributed at the Senior level.
Marks Awarded | Number of Groups | Number of Constraints |
---|---|---|
3 marks | ||
5 marks | ||
7 marks |
Output an integer between
1
ELODIE CHI
0
2
DWAYNE BEN ANJALI
CHI FRANCOIS ELODIE
0
There is only one constraint and it is not violated: ELODIE and CHI are in the same group.
3
A B
G L
J K
2
D F
D G
4
A C G
B D F
E H I
J K L
3
The first constraint is that A and B must be in the same group. This is violated.
The second constraint is that G and L must be in the same group. This is violated.
The third constraint is that J and K must be in the same group. This is not violated.
The fourth constraint is that D and F must not be in the same group. This is violated.
The fifth constraint is that D and G must not be in the same group. This is not violated.
Of the five constraints, three are violated.
Ron wants to build a square pool in his square
The first line of input will be an integer
The following table shows how the available 15 marks are distributed.
Marks Awarded | Length/Width of Yard | Number of Trees |
---|---|---|
3 marks | ||
5 marks | ||
4 marks | ||
3 marks |
Output one line containing
5
1
2 4
3
A picture of the yard is below. The location of the tree is marked
by and one of several
15 8 4 7 4 1 14 11 10 6 13 4 4 10 10 3 9 14
7
A picture of the yard is below. The location of each tree is marked
by and one of several