You have trouble remembering which type of triangle is which. You write a program to help.
Your program reads in three angles (in degrees).
If all three angles are 60, output
Equilateral.
If the three angles add up to 180 and exactly two of the angles
are the same, output Isosceles.
If the three angles add up to 180 and no two angles are the same,
output Scalene.
If the three angles do not add up to 180, output
Error.
The input consists of three integers, each on a separate line.
Each integer will be greater than 0 and less than 180.
Exactly one of Equilateral,
Isosceles, Scalene
or Error will be printed on one line.
60
70
50
Scalene
60
75
55
Error
A vote is held after singer A and singer B compete in the final round of a singing competition. Your job is to count the votes and determine the outcome.
The input will be two lines. The first line will contain \(V~(1 \leq V \leq 15)\), the total number of votes. The second line of input will be a sequence of \(V\) characters, each of which will be \(A\) or \(B\), representing the votes for a particular singer.
The output will be one of three possibilities:
A, if there are more \(A\) votes than \(B\) votes;
B, if there are more \(B\) votes than \(A\) votes;
Tie, if there are an equal number of
\(A\) votes and \(B\) votes.
6
ABBABB
B
6
ABBABA
Tie
Antonia and David are playing a game.
Each player starts with 100 points. The game uses standard six-sided dice and is played in rounds. During one round, each player rolls one die. The player with the lower roll loses the number of points shown on the higher die. If both players roll the same number, no points are lost by either player.
Write a program to determine the final scores.
The first line of input contains the integer \(n~(1 \leq n \leq 15)\), which is the number of rounds that will be played. On each of the next \(n\) lines, will be two integers: the roll of Antonia for that round, followed by a space, followed by the roll of David for that round. Each roll will be an integer between 1 and 6 (inclusive).
The output will consist of two lines. On the first line, output the number of points that Antonia has after all rounds have been played. On the second line, output the number of points that David has after all rounds have been played.
4
5 6
6 6
4 3
5 2
94
91
After the first round, David wins, so Antonia loses 6 points. After the second round, there is a tie and no points are lost. After the third round, Antonia wins, so David loses 4 points. After the fourth round, Antonia wins, so David loses 5 points. In total, Antonia has lost 6 points and David has lost 9 points.
You are hosting a party and do not have room to invite all of your friends. You use the following unemotional mathematical method to determine which friends to invite.
Number your friends \(1,2,\ldots,K\) and place them in a list in this order. Then perform \(m\) rounds. In each round, use a number to determine which friends to remove from the ordered list.
The rounds will use numbers \(r_1, r_2,\ldots, r_m\). In round \(i\) remove all the remaining people in positions that are multiples of \(r_i\) (that is, \(r_i, 2r_i, 3r_i, \ldots\)) The beginning of the list is position 1.
Output the numbers of the friends that remain after this removal process.
The first line of input contains the integer \(K~(1 \leq K \leq 100)\). The second line of input contains the integer \(m~(1 \leq m \leq 10)\), which is the number of rounds of removal. The next \(m\) lines each contain one integer. The \(i\)th of these lines \((1 \leq i \leq m)\) contains \(r_i~(2 \leq r_i \leq 100)\) indicating that every person at a position which is multiple of \(r_i\) should be removed.
The output is the integers assigned to friends who were not removed. One integer is printed per line in increasing sorted order.
10
2
2
3
1
3
7
9
Initially, our list of invitees is \(1,2,3,4,5,6,7,8,9,10\). There will be two rounds of removals. After the first round of removals, we remove the even positions (i.e., every second position), which causes our list of invitees to be \(1,3,5,7,9\). After the second round of removals, we remove every 3rd remaining invitee: thus, we keep \(1\) and \(3\), remove \(5\) and keep \(7\) and \(9\), which leaves us with an invitee list of \(1,3,7,9\).
The CEMC is organizing a workshop with an activity involving pairs of students. They decided to assign partners ahead of time. You need to determine if they did this consistently. That is, whenever A is a partner of B, then B is also a partner of A, and no one is a partner of themselves.
The input consists of three lines. The first line consists of an integer \(N~(1 < N \leq 30)\), which is the number of students in the class. The second line contains the first names of the \(N\) students separated by single spaces. (Names contain only uppercase or lowercase letters, and no two students have the same first name). The third line contains the same \(N\) names in some order, separated by single spaces.
The positions of the names in the last two lines indicate the assignment of partners: the \(i\)th name on the second line is the assigned partner of the \(i\)th name on the third line.
The output will be good if the two lists of
names are arranged consistently, and bad if
the arrangement of partners is not consistent.
4
Ada Alan Grace John
John Grace Alan Ada
good
Ada and John are partners, and Alan and Grace are partners. This arrangement is consistent.
7
Rich Graeme Michelle Sandy Vlado Ron Jacob
Ron Vlado Sandy Michelle Rich Graeme Jacob
bad
Graeme is partnered with Vlado, but Vlado is partnered with Rich. This is not consistent. It is also inconsistent because Jacob is partnered with himself.