CCC 2013 Question 3

I am not very experienced at c++ programming so can someone assist me in question 3 of CCC 2013?

http://www.cemc.uwaterloo.ca/contests/computing/2013/stage1/juniorEn.pdf
How would you do it on paper?
Topic archived. No new replies allowed.