Its a programmer thing...
Programming tips, coding gyaan, and the rantings of a self-proclaimed Indian programmer.
Sunday, February 5, 2012
my repository is alive!
https://github.com/cracker2excel/Online-Judge-Solutions
Sunday, June 12, 2011
SPOJ 450. Enormous Input Test Problem Code: INTEST
{
register char c=0;
while (c<33) c=getchar();
*a=0;
while (c>33)
{
*a=*a*10+c-'0';
c=getchar();
}
}
I used it and my execution time became reduced by 2 seconds to 3.40 s
{
register char c=0;
while (c<33) c=getchar_unlocked();
*a=0;
while (c>33)
{
*a=*a*10+c-'0';
c=getchar_unlocked();
}
}
Wednesday, May 25, 2011
SPOJ 24. Small factorials. Problem code: FCTRL2
SPOJ 5. The Next Palindrome Problem code: PALIN
Wednesday, April 13, 2011
SPOJ 1688. A Very Easy Problem! Problem code: EASYPROB
The problem asks you to output some form of these numbers: 137, 1315, 73, 136, 255, 1384, 16385, one per line in the listed order.
Let’s see the first line of the correct output:
137=2(2(2)+2+2(0))+2(2+2(0))+2(0)
Hmmm… I don’t want to take the fun out the problem by giving the answer directly to you. So, I will give you a clue.
The clue:
If you have been thinking in this direction :
“How can I make the left hand side (in this case 137) to become the right hand side?”
Stop thinking!
The right direction to think for this problem is:
“How can I make the RIGHT HAND SIDE of the equation to become the left hand side?”
Got it?
Let's Get It Started!
For those who interested in solving the problems in SPOJ, UVA and the like…
I have found that there are not many resources available on the net when I get stuck with a problem. There are very few tutorials available out there that explain how to solve a problem. I usually end up browsing through forums looking for clues…
Well… I am going to write in this blog, tutorials for some of the problems that I have and am going to solve…
However, note that I am going to write here how I solved the problem and not the BEST way to solve the problem… (hey! I am just an average coder…)
Hope this would be helpful to someone.
Happy coding!!