added code for Uva:336
Merge pull request #16 from rahulroot/336-code

added code for Uva:336