PEG Test – Oct 3rd, 2014

Problem A: Water

Waterbending is characterized by being fluid and graceful, acting in concert with the environment. Young Avatar Aang is trying to master this unique art with the help of his friend Katara. Katara gives Aang three identical jars with equal amounts of water inside to practice on. Seeing how their practice is going so well, Sokka came over to play a prank. While Aang and Katara are taking a break, Sokka places a fish in one of those jars. Since Aang had just gotten used to the original weights of the jars, Sokka postulates that the added weight will surely throw him off.

What's more – the larger the fish, the more Aang will be thrown off. However, while Sokka was snickering to himself about how brilliant the prank was, he accidentally mixed up the jars. Now, given the weights of the jars, he would like to how much fish weighs so he can know just how much Aang will screw up.

Input Format

There will be 3 lines of input in no particular order. Lines 1, 2, and 3 will each contain the weight of a jar (all positive integers ≤ 100) – one of which will include the fish.

Output Format

Output a single line containing a single integer – the weight of the fish.

Sample Input

12
17
12

Sample Output

5

Explanation

The second jar is heavier than the both the first and the third one. Therefore it must contain the fish, which weighs 17 − 12 = 5.

All Submissions
Best Solutions


Point Value: 3
Time Limit: 2.00s
Memory Limit: 16M
Added: Oct 06, 2014
Author: frenzybenzy

Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

Comments (Search)

I don't really understand how does this come .. ?


Reading problem statements is a skill of its own. Furthermore, for this question, you can completely ignore the backstory and just read the format and sample.

My code will not print out anything for some reason can someone tell me why?

Code removed by admin. Please do not submit code in comments.

first of all, look through your logic first, if A==B&&B==C return? where does it say that? and A==B | !(B==C) return? where does it say that? my point is that these two are absolutely not useful AT ALL and please read the question carefully, and please look through your code first before asking question like this.

my code works on ideone, and works properly with the test case show, but when i put it into peg judge, it only gives me 10/50. can someone help?

Your code does not appear to me to work on the shown test case. I suggest trying out some inputs and tracing through your program. There are three simple cases to try.

Here's a hint: you're printing negative numbers.

what does it mean by:
Traceback (most recent call last):
File "./prog.py", line 8, in <module>
TypeError: unsupported operand type(s) for -: 'str' and 'str'

The error code tells you your problem. How can you subtract two strings? Search up the difference between an integer and a string.