uva 10246 Asterix and Obelix:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1187
pdf:
http://uva.onlinejudge.org/external/102/10246.pdf