proA solved

*.pdf is the problem description, *.cpp is method