I have more wrong submissions for this problem than any other one until now. The reason? I was oblivious to the fact that the default rules for type-conversion between double and long in C++ include floor()ing positive values and ceil()ing negative ones. (more…)
There are few better ways of spending your vacations than trying to solve a series of programming problems, especially when you’re trying to learn something new related to those problems.
And this is where Programming Challenges pops in the picture. It is a combination of book containing about one hundred selected problems from various international competitions of the past. There are two online judges for checking solutions, the book’s own website and another site called UVa Online Judge. I will be constantly keep posting code on my blog as I keep solving problems according to the book’s chronological order.
P.S. Since I wanted to practice STL, please bare with its bloated usage that you’re bound to find in my solutions.