Monday, June 18, 2012

I am really impressed by www.algorithmist.com it is a great way to explore the programming problems on www.spoj.pl. I am going to do the same for www.codechef.com. I am planning to break down the programming problems.

So here is the first problem


problem-link: http://www.codechef.com/submit/HS08TEST

crux of problem:
The problem needs you to compare floating point numbers and print the output with a fixed decimal precision. The problem states that the range is from 0 to 2000 and precision is 2 decimal places.
Note: In languages like C++, C the floating point comparison can be tricky.

solution:
I converted all the float values into int. then processed and later converted back to float.

source code:
https://github.com/ramprasadg/AlgosForOnlineJudges/blob/master/CodeChef/HS08TEST.cpp

No comments: