Finn loves Fours and Fives. In fact, he loves them so much that he
wants to know the number of ways a number can be formed by using a sum
of fours and fives, where the order of the fours and fives does not
matter. If Finn wants to form the number
Your task is to help Finn determine the number of ways that a number can be written as a sum of fours and fives.
The input consists of one line containing a number
The following table shows how the available 15 marks are distributed.
Marks Awarded | Bounds on |
Additional Constraints |
---|---|---|
3 marks | None | |
2 marks | ||
2 marks | ||
8 marks | None |
Output the number of unordered sums of fours and fives which form the
number 0
if there are no such sums of fours and
fives.
14
1
This is one of the examples in the problem description.
40
3
This is one of the examples in the problem description.
6
0
There is no way to use a sum of fours and fives to get
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.
You are composing music for the Cool Clarinet Competition (CCC). You
have been instructed to make a piece of music with exactly
We call a non-empty sequence of consecutive notes in the piece a
sample. For instance,
We call a sample good if no two notes in the sample have the same pitch.
The clarinet players are picky in two ways. First, they will not play
any note with pitch higher than
Can you construct a piece to satisfy the clarinet players?
The first and only line of input will contain
The following table shows how the available 15 marks are distributed.
Marks Awarded | Bounds on |
Bounds on |
Bounds on |
---|---|---|---|
3 marks | |||
3 marks | |||
4 marks | |||
5 marks |
If there is a piece of music that satisfies the given constraints,
output
Otherwise, output
3 2 5
1 2 1
Notice that the piece is composed of
Note that the piece 2 1 2
is the only other
valid output for this input.
One example of an output that would be incorrect is
3 2 3
, since it has notes with pitches larger
than 2. Another incorrect output would be
1 1 2
, since it only has four good samples:
5 5 14
1 5 3 2 1
The 14 good samples are:
5 5 50
-1
There are no pieces with 5 notes that can produce 50 different good samples.
Andrew is a very curious student who drew a circle with the center at
Andrew drew
A good triplet is defined as a triplet
The origin
Lastly, two triplets
Andrew, being a curious student, wants to know the number of distinct good triplets. Please help him determine this number.
The first line contains the integers
The second line contains
The following table shows how the available 15 marks are distributed.
Marks Awarded | Number of Points | Circumference | Additional Constraints |
---|---|---|---|
3 marks | None | ||
3 marks | None | ||
6 marks | |||
3 marks | None |
Output the number of distinct good triplets.
8 10
0 2 5 5 6 9 0 0
6
Andrew drew the following diagram.
The origin lies strictly inside the triangle with vertices
There are
Initially, each student Y
) or does not intend to write the CCC (if
N
). Initially, at least one student intends to
write the CCC, and at least one student does not intend to write the
CCC.
The CCC has allocated some funds to pay some students to be
influencers for the CCC. The CCC will repeatedly choose one student
Help the CCC determine the minimum cost required to have all of the students intend to write the CCC.
The first line contains the integer
The next
The next line contains Y
or
N
.
The next line contains
The following table shows how the available 15 marks are distributed.
Marks Awarded | Number of students | Payment | Additional Constraints |
---|---|---|---|
5 marks | |||
7 marks | None | ||
3 marks | None |
Output the minimum integer number of dollars required to have all of the students to intend to write the CCC.
4
1 2
2 3
3 4
YNYN
4 3 6 2
6
The CCC should pay $6 to student 3 to deliver a seminar to their friends (students 2 and 4), after which all 4 students will intend to write the CCC.
15
1 5
5 2
2 15
15 4
2 10
8 3
3 1
1 6
11 6
12 6
11 9
11 14
12 7
13 7
NNYYYNYYNNNNNNN
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
6
One optimal strategy is for the CCC to ask students 5, 1, 6, 11, 7, and 2 to deliver seminars, in that order, paying them $1 each.