October 25, 2011

Project Euler #315

Problem: Digital Root Clocks

Solution: [Spoiler Ahead]

       One of the easy problems and one of the easy solutions.
       It's just straight forward,

the number of LED on-off by SAM's clock - the number of LED on-off by MAX's clock

       Globals I used, a noOfLEDsForDigit[] array holding the number of led's required to glow a particular digit.
A digits[] array holding hex values for the number that represent the ON-OFF LED. e.g.




bit LED
------------
0 top
1 middle
2 bottom
3 top-left
4 top-right
5 bottom-left
6 bottom-right



     Digit   Binary representation    Hex_value
-------------------------------------------------------
0 0111 1101                      0x7d
1 0101 0000                      0x50
2 0011 0111                      0x37
3 0101 0111                      0x57e
4 0101 1010                      0x5a
5 0100 1111                      0x4f
6 0110 1111                      0x6f
7 0101 1001                      0x59
8 0111 1111                      0x7f
9 0101 1111                      0x5f

                 Now the calculations become very easy,

For SAM: it's just the twice the sum of number of LED's in the digit(or no. of 1's in it's binary representation according to above user-defined digits)

For MAX: we need to get the common LED that will not be turn off when number changes from 'a' to 'b', this is given by XORing both value i.e.(a^b), plus the LED's that need to be turned on to complete the number 'b'.


There it is , therein lies the rub !


May 28, 2011

8 on 8

                    So finally, everything is completed and and perfect 8 on 8. I am now a Bachelor of Technology, what I would be liked to be called. After entering the CoEP and seeing all the brilliant students around I had thought that probably getting out of CoEP is more difficult than getting in.

           First Year: began with all the intros given to seniors(which I owe a  lot as it made me think that I didn't had anything special in me, I need to make myself into some or the other thing). The lectures went repeating some physics and chemistry part.Technically was introduced to the C-Programming which I even didn't know that this is going to be with my entire life henceforth. Even by the end of the first year, I didn't get to know the concept of a programming language, but I sored quite well in it(thanks to my friends, and this is the part where your friends help you a lot :P). As usual not to mention, when it comes to engineering Mathematics never leaves your collar bone. Bunked some lectures for the Regatta.


            Second Year: gave exposure to the computer graphics and latest technologies.Also one whole semester was wasted (ohhhhh no I'm sorry *vested*) in understanding stack and queues alone.Trees and graphs still remaining a nightmare to me and many others. Database Systems didn't move a page ahead even after 2 months of continuous efforts of the professor. Tried to make a manual robot for the dogfight and a micro-mouse in the College's Annual Tech-fest MindSpark with very few achievements which would be better to called nil.

                    Third Year: was busy amongst all the four years. This was the time when I understood what IT is? and what I'll be doing for the rest of my life. Tried to learn new things and got hands on few platforms but was still a naive in all those areas. Graduate Aptitude Test in Engineering didn't go quiet well giving me a rank of above 7000.




               Final Year: the main ground and the most important time of my life. This year taught me a lot of good things as well as bad things. I got to learn many things from my experience which eventually improved my point of view towards life and the ways to deal with the problems. As a human I was a changed being by the end of the year.

May 2, 2011

Aarz hai




Taaro ko ginne wale hum na the,
akele gungunane wale hum na the,
Ye to dosti aadat laga di,
varna kisi ko itna yaad karne wale hum na the.








Iss kadar na har baat yaaron se pucho,
Jo baat raaz ki ho isharo se pucho,
Lahero se khelna to samandar ka shauk hai,
lagti hai chot kaise kinaron se pucho.





Bheg jati hai palkein tanhayi me,
darte hai koi janna le,
Pasand karte hai tez barsaat mein chlana,
kahi rote hue ko koi pehchaan na le.

Kal fursat na mili toh kya koroge,
itni si mohlat na mili toh kya karoge,
Roj kehte ho kal baat karenge,
kal hamari aakhen na kholi toh kya karoge.








Wo shasks meri jaan bana rehta hai,
uska pyar meri pehchaan bana rehta hai,
Koi yad karta hai usko kitni shidat se,
wo janta he magar anjan bana rehta hai.




Guzra waqt dil ki baat sunaega,
kabhi saath the hum hal pal yaad aayega,
Gaur se palatna zindagi ke panno ko,
kahin na nahin to hamara naam jarur nazar aayega.

Still trying to code ....


Introduced to programming language C and C++ in first year of my 4 year Engineering Course. Till the end of the year, I hardly understood the power of programming. But eventually the time spent dwindling with online tutorials in the summer break was a real break for me !!!

Spending next 6 months on data-structure, I got to know how to use the correct tool for the given problem, but many a times my decisions didn't gave any result. Codechef, Topcoders, Codeforces as proved a motivational platform to develop my skills.


But still after a period of 3 years, I am not able to get around some difficult problems :( . One needs to really work hard to develop the proper skill, which I think I still haven't.


         
               If I had to put my current scenario in the current sense then the quote correctly depict that. At some point of your life , you reach a stage when you need help, but wouldn't find one. The answer to this is just 'Patience'. As it is rightly said "All human wisdom is summed up into two words wait and hope".