ChE 26 MP 1 PROBLEM 1: Tangent Circles 1. The two lines are symmetrical with each other but the distance between the farthest points is variable. 2. The smallest circle should not be less than one unit in diameter. 3. All circles and lines are tangent to each other. 4. You NEED to shade the regions between the circles and the lines.
PROBLEM 2: Homework Scheduling Jim and Jam were best friends since high school. They share their fries with each other, drink coffee together, buy suits together, have brunch together - almost everything. In college, they enroll in the same classes all the time. At one point, their teacher gave them a very difficult homework to be done by pair. They must do it as fast as they can so they have time to watch movies after. The homework has two items: Problem A and Problem B. Each problem has 2 questions, Q1 and Q2, but Q1 must be answered first before Q2. Q1 mainly requires computation, while Q2 requires plotting skills. After reading everything, Jim and Jam estimated how long they can do each part. Jim wanted to do Q1 only because he’s not good in plotting. So Jam settled to do Q2. Write a program that accepts 4 integers, A1, B1, A2, and B2, in that order. If Jim can finish Problem A-Q1 in A1 minutes, and Problem B-Q1 in B1 minutes, while Jam can finish problem A-Q2 in A2 minutes and Problem B-Q2 in B2 minutes, output the earliest time they can finish the homework (in minutes). Remember that Jim and Jam can only work on 1 question at a time, and Jam can’t start without the answers from Q1. Jim may opt to start on any item. If any of them had already started on a question, they will have to finish it before doing anything else. See sample test cases. Sample I/O
A1
B1
A2
B2
Output
1
1
2
2
5
2
5
4
3
10
2
5
3
4
11
4
6
1
6
13
PROBLEM 3: Problem X Encryption
Our task is to write a “simple” Atbash using what is called the encryption key. We will limit ourselves to the letters, “a-z” and “A-Z” and the numbers “0-9”. In total that’s 62 characters. The encryption key is limited to only 8 characters in length. So for this task, our inputs would be a message of any length and an 8 character encryption key. For each letter in our message, we change the letter into another letter based on the corresponding letter in our encryption key. The first letter of the message with the first letter in the encryption key, the second of the message with the second of the encryption, .., the ninth letter of the message with the first letter in the encryption key, etc. We do this until we run out of message and display the output message. If a character is not a letter or number, we ignore it but we assume we used the corresponding key. For example, we have the encryption key “whatthis.” Then for a message like “well, this is the 1st MP” we use the first character “w.” This “w” is shifted by the amount “w” which is the 23rd letter. Since the capital letters are different, I shift my “w” into the 20th letter in the capitals (the 3 remaining letters is where the other 3 went), which is the letter “T.” The next letter is “e” shifted by “h” which is the 8th letter. So shifting “e” by 8 letters we get “m.” Moving forward we get, “TmmF, CAFA CM CAB 2MN V8” as our final encoded message. a) b) c)
Create the encryption mapping Use the mapping to encode messages Use the mapping to decode messages
Other examples Encryption key
Message
Encoded
dontwant
Sometimes you just have to
WDAyQjAyw MIR xOwl Bxws xD
wHyohwHy
Just because
62RI yMBx2Rt
help1pls
Bawal magtanong sa katabi
JfIqd ytoymDgDs Af A2jmuq
pewPEWpo
Isa isa lang sa banyo, bawal sabay
Yxx Nfq BfKW fq rfKet, qqBx1 fqqqD
boomBOOM
Well, sorry naman
YtAy, 71tGN PP1Np