Woburn Challenge 2017-18 Round 2 - Junior Division
Problem 1: The Rings of Power
E Rings for the Elven-kings under the sky,
D for the Dwarf-lords in their halls of stone,
M for Mortal Men doomed to die,
One for the Dark Lord on his dark throne,
In the Land of Mordor where the Shadows lie,
One ring to rule them all, one ring to find them,
One ring to bring them all and in the darkness bind them,
In the Land of Mordor where the Shadows lie.
As the above passage indicates, a number of Rings of Power exist in Middle-earth, with exactly one of them owned by the Dark Lord Sauron, and the others distributed amongst Elves, Dwarves, and Men according to the values E, D, and M (2 ≤ E, D, M ≤ 9). Your task is to determine the total number of Rings of Power which have been forged (that is, the number of rings held by Elves, Dwarves, Men, and Sauron combined).
The first and only line of input consists of three space-separated integers, E, D, and M.
Output a single integer, the total number of Rings of Power.
3 7 9
Elves have 3 Rings, Dwarves have 7, Men have 9, and Sauron himself has 1, for a total of 20.
Point Value: 3
Time Limit: 2.00s
Memory Limit: 16M
Added: Feb 23, 2018
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3