Spoj Problem Knifes are Fun

Algorithm - Sorting
Problem Link:
http://www.spoj.com/problems/JOKER1/