Sunday, January 3, 2016

UVA 11340 : Newspaper

 Ah, this question led me to learn new things, strangely.

It is pretty easy to implement this one, but I was getting WA. And then when I went on uDebug, I found this link :  and I thought may be character encoding/decoding would be the reason I am stuck.

So, I read this article followed by another good article : I really enjoyed reading both of these articles. It's always great to learn something you don't know of, and I certainly didn't knew of unicode and all the stuff.

But alas, I still got a WA even after doing all the implementation corrections as mentioned in the articles. Later, I found out that the reason I am getting WA is because after finding the answer in cents, I was doing something as I have shown in the code uva11340-wrongway.cpp

You see the stupidity I was doing?! Well I was mixing up the strings with floating point values, and that's why all those WAs.

Simply the following has had to be done, as shown in the code uva11340-rightway.cpp!!

See if you have done some silly mistake like that, it was a big lesson that I learned today.

No comments:

Post a Comment