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.
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 a single line containing a single integer – the weight of the fish.
12 17 12
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.
Point Value: 3
Time Limit: 2.00s
Memory Limit: 16M
Added: Oct 06, 2014
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3