The rating algorithm is a function which takes 2 inputs in the form of Ratings before this contest and Ranks in this contest and gives the final Rating as output.
So rating before is already there in your a/c, now left second function i.e. rank. The ranking system is different for Short, Long & Lunchtime. You can read about ranking mechanism here : http://www.codechef.com/rankings/