Code Experts 2.0 was a programming competition for school children, organized by IEEE student branch of University of Moratuwa in 2014 for the 2nd consecutive time. It is a 6 hour coding challenge, where school students are free to form a group of three. At that time I was a member of problem creation panel and we were supposed to add creative and unique questions to the competition. The question give below called “Happy and Sad Numbers” was added by me.
Question
A number which sum of squares of
individual digits eventually equal to 1 is called a Happy Number otherwise
called a Sad Number.
You
have to count the number of sad numbers with tail size k Ñ” Z+ in
given range X = [a, b], where a, b Ñ” Z+ and a < b < 109
Input Format
a space b space k
Sample Input (10 1000 is interval(closed) and 7 is tail size)
10 1000 7
Sample Output
83
More Sample input and outputs
“Hotel California” was widely acclaimed to be one of the best musical creations in the history of music. It does not take an inquisitive mind to observe that “Hotel California” is a truly unique masterpiece. And building on a similar pillar, the song has also developed its own mystique aura due to the variations of interpretations in the song meaning.
“Hotel California” as a single, was released in 1977 from The Eagle’s 5th studio album titled ‘Hotel California’. The album was produced by Bill Szymczyk, who had no special musical training or talent, but just extraordinary listening skills. The song was recorded by the ‘Criteria Studios’, ‘Miami & Record Plant’. The band musicians entail Glen Frey, Joe Walsh, Don Felder, and Randy Meisner. The song lasted for 6 minutes and 30 seconds.
Review of the Lyrics
Henley does the lead vocals, and he starts by saying;
On a dark desert highway, cool wind in my hairWarm smell of colitas, rising up through the air
These lyrics may look simple but there can also be a deeper meaning in it. Related to the singer’s life, this can show a dark time in his. Some critics term “Hotel California” as an outlook of California State. It was a land of promise many centuries back, thus the popular quote ‘California dream’. But during the 60’s and 70’s, California is a place of drugs heartbreaks, and shattered dreams.
Up ahead in the distance, I saw a shimmering light
My head grew heavy and my sight grew dim
My head grew heavy and my sight grew dim
The singer may be getting tired of the highs of music industry and what also comes with it. It’s flashing lights throughout the day for the celebrities, which makes them fairly blind to what’s real and what’s actually not.
I had to stop for the night
There she stood in the doorway;
I heard the mission bell
And I was thinking to myself,
"This could be Heaven or this could be Hell"
There she stood in the doorway;
I heard the mission bell
And I was thinking to myself,
"This could be Heaven or this could be Hell"
"I had to stop for the night" could mean that the singer tries to get away from the stardom, wonder where that really leads him.
Most times, celebrities that are tormented with the high-life usually end up with of drugs to get away from the reality. Another famous interpretation of “Hotel California” can be that the song is addressing drug addiction. Just before you do the first shot, you take a second to actually think it through and later goes ahead anyway. On that second, the moment of your death is approaching. Drugs are a really place of heaven and hell. When you intake them, it’s a make-belief paradise. But what usually ends it is an obvious hell.
Then the chorus comes in here;
Welcome to the Hotel California
Such a lovely place (Such a lovely place)
Such a lovely face
Plenty of room at the Hotel California
Any time of year (Any time of year)
You can find it here
If the hotel is that good, how come it doesn’t get filled in? Except, there is a way to control or free the people coming in
She got a lot of pretty, pretty boys she calls friends
How they dance in the courtyard, sweet summer sweat.
Some dance to remember, some dance to forget
Tiffany is a popular high end jewelry seller. Mercedes Benz is possibly the top luxurious brand back in the 70’s.
Many handsome men fall behind her devoured beauty, but she doesn’t settle down with them. She has friend-zoned them, as we call it now. They are all enjoying the music and also dancing off. Many people are trying to make memories while some are trying to forget their problems. “Hotel California” might be describing the state of the men and women in California back in those days. It was life full of party for those that come chasing their dreams to California. They mostly end up wasting their money and time on loose drugs and women.
So I called up the Captain,"Please bring me my wine"
He said, "We haven't had that spirit here since nineteen sixty nine"
The was really no significance of the year 1969, just for the fact that ‘The Satanic Bible’ was published that year, and that has enhanced “Hotel California” to gain a reputation as a hallelujah to Satan. And it might just be that Don Henley wanted a word to rhyme with ‘wine’ in the last line.
And still those voices are calling from far away,
Wake you up in the middle of the night
Just to hear them say...
Wake you up in the middle of the night
Just to hear them say...
Yet, distant voices inhabit the Hotel California, even at the mid-night.
Welcome to the Hotel California
Such a lovely place (Such a lovely place)
Such a lovely face
They livin' it up at the Hotel California
What a nice surprise (what a nice surprise)
Bring your alibis
Such a lovely place (Such a lovely place)
Such a lovely face
They livin' it up at the Hotel California
What a nice surprise (what a nice surprise)
Bring your alibis
The chorus of “Hotel California” actually changes from its previous appearance. Living in the hotel and also ‘living it up’ in the hotel have different meanings. Living it up means that you enjoy the stay, the party and you live to the fullest. This might be referring to drugs again. And this last line aids the interpretation. An ‘alibi’ is a scapegoat. You actually live it up and also get into bad habits, but you always have an excuse, right?
Mirrors on the ceiling,
The pink champagne on ice
The pink champagne on ice
Mirrors do reflect things. ‘Pink champagne’ is slang for a top class drug. Hotel California is full with drugs, just like the state of California in those days.
And she said "We are all just prisoners here, of our own device"
This is a good description of the famous life of musicians that end up frustrated, depressed and psychologically exhausted because of the non-stop high life. They cannot just catch a break. And “Hotel California” sings the musicians are now prisoners/slaves to what they have created themselves. The music industry actually has the tendency to suck its makers.
They gathered for the feast
They stab it with their steely knives,
But they just can't kill the beast
The lyrics above are one of the major reasons why “Hotel California” has got a reputation as a cult song worshiping Satan.
The song talks about some rituals to please the master -which master? It’s not known. They stab the beast just to kill it, but they fail. If this happens to be a reference to drugs, its mean could be that addiction has just taken over. There is no going back or preventing the beastly lust for drugs. It just cannot be killed. In a similar manner California was a state which could offer you a feast. And those that fall for that dream, come in, and get lusty for fortune and fame and it can never be killed.
Running for the door
I had to find the passage back
To the place I was before
If when the reality comes in, celebrities note the horrors of Hotel California which is AKA California State AKA drug addiction. Then they actually run. It’s a very difficult task to withdraw back when you’re this deep in the hotel.
"We are programmed to receive.
You can check-out any time you like,
But you can never leave! "
Another character comes in in “Hotel California.” It’s a night man this time (probably a security officer) gives the hard truth. The hotel is just programmed to receive (though that hotel isn’t programmed, they actually operate the way humans operates them). Then the night man gives the final verdict. The singer can ‘check out’ the hotel any time but he can never leave.
Even if the musician quits the drugs, it has a hold on him still. The person who leaves Hotel California is verily not the same person that went in. So, it is correct in a way to actually say the ones that come in never leave.
Medieval (c.1150 - c.1400)
This is the very first period, the place where we can start to be fairly sure of as to how a huge deal of the music that has survived really sounded. The first written secular music started from the 12th century troubadours (in the form of ballades, estampies, virelais,etc.), but many notated manuscripts come from places of learning mostly associated with the church, and thus unavoidably have a religious basis.
Gregorian plainsong and chant which are monodic (i.e. written as a single musical line) progressively developed during the 11th to 13th centuries to organum (i.e. double or three lines moving at the same but independently, thus almost unintentionally representing the commencements of harmony). Organum was formerly rather stifled by solid rules governing rhythm and melody, which had absolutely led to the Ars Nova period during the 14th century, ultimately represented by these composers; Landini, de Vitry, and Machaut.
Renaissance (c.1400 - c.1600)
The 15th century witnessed increased freedoms, most especially in terms of what is perceived as ‘polyphony’ and 'harmony'. Composers were still almost all given to choral writing, and some instrumental compositions that have survived frequently give the impression of being vocal works in guise, but remove the words.
There is obvious latest delight in contrast and textural variety, so that a particular part of text could be enhanced, for example, by a vocal part dropping out progressively, only to return at a unique moment of emphasis. Dunstable, Dufay, Despres and Ockeghem were the four most powerful composers of the 15th century.
The second part of the sixteenth century witnessed the commencements of the tradition that many music lovers associate with normal feel of 'classical' music. Progressively, composers shifted away from the modal style of harmony that had predominated for more than 300 years, towards the arrangement of their work into minor and major scales, hence, imparting the powerful sensation of each piece possessing a definite tonal centre or 'key'.
This was also a golden period for choral composition as flow of acapella masses, anthems, madrigals, psalms and motets where been written by the masters of the age. Also, instrumental music, especially keyboard music, came into its own for the very first time in the form of variations, fantasias, and dance movements (pavanes, galliards etc.). Composers of this particular note include Palestrina, Frescobaldi, Victoria, Gibbons, Lassus, Byrd, Alonso Lobo, Tallis, Duarte Lobo, Dowland, Cardoso and Gesualdo.
Baroque (c.1600 - c.1750)
During this Baroque period, the bases were laid for about the next 300 years of musical expression: the modern orchestra came into existence, with opera (including the chorus, aria, overture, recitative and prelude), the sonata, concerto, and modern cantata. The soft-grained viol string family of the Renaissance period was gradually substituted by the bolder violin, cello and viola, the harpsichord was discovered, and all instrumental groups made essential advances.
Until around 1700, the old modes exerted themselves by adding color to certain chord progressions or melodic lines, but from the commencement of the 18th century, the modern harmonic style based on the minor and major scales was effectively pan-European. Choral music did not dominate any longer, and as composers shifted more to writing idiomatic instrumental works for ensembles of increasing color and variety, so 'classical' music progressively started to work its way into the fabric of society, being played outdoors at special functions or dinner parties (e.g. Handel's Water Music), or such as a spectacle in the form of opera. On a real domestic level, every rich lady would possess a spinet to play, and at meal-times the rich and large houses would call musicians to play what was famously referred to as Tafelmusik in Germany, of and which Telemann was perhaps the most popular composer.
The following were outstanding of the seventeenth century composers who made way for this famous explosion of 'classical' music,: Alessandro Scarlatti, Corelli, Schutz, Monteverdi, Buxtehude, Lully and Purcell. Still, the most famous composers of that period, indeed those who define the sound of Baroque music by their names at its most colorful are Rameau, Handel, François Couperin, Johann Sebastian Bach, Domenico Scarlatti, Vivaldi, and Telemann, all of them at their creative apex during the first period of the eighteenth century.
Classical (c.1750 - c.1830)
The Baroque period witnessed the existence of some musical genres that would maintain a hold on composition for several years to come; still it was the Classical period that witnessed the introduction of a form which has taken over instrumental composition to this present day: sonata form. Along with it was the development of the modern concerto, sonata, symphony, trio and quartet to a new peak of expressive and structural refinement. If Baroque music should be notable for its textural intricacy, therefore the Classical period is characterized by a near-obsession with structural clarity.
The seeds of this Classical age were planted by some composers whose names are now forgotten such as Honnauer and Schobert (both Germans were very active in Paris), as well as some historically respected names, including Boccherini, Gluck and at least 3 of Johann Sebastian Bach's sons: Wilhelm Friedmann, Johann Christian, and Carl Phillip Emmanuel (those referred to as 'London' Bach).
Early Romantic (c.1830 - c.1860)
As the Classical period got to its peak, it was becoming clearly that the intensity and amount of expression composers were looking to achieve was starting to go above that which a classically sized/designed piano/orchestra could possibly comprehend. The next moment in musical history found composers trying to balance the formal and the expressive in music with some approaches that would have left composers of any latter age utterly bewildered. As the musical area opened up, with nationalist schools starting to emerge, it was the search for individuality and originality of expression that commenced here which was to be such an over-riding obsession in that present century.
The Romantic era happened to be the golden age of the virtuoso, a place where the most evil difficult music would be performed with unconcerned ease, and the most harmless theme in a composition would be created at great length for the adoring audience to enjoy. The demonstrative range of music at this period was widened, as its harmonic vocabulary was, and the number and range of instruments that could be called on to play it. Music usually had a 'programme' or story-line associated with it, sometimes of a despairing or tragic nature, seldom representing such natural phase as galloping horses or rivers. The next one hundred years would seek composers either embracing the ideals of Romanticism whole-heartedly, or in few ways reacting against them.
Two Nationalists deserve outstanding mention of the early Romantic composers, the Bohemian Smetana and the Russian Glinka. However, the 6 leading composers of that age were undoubtedly Verdi, Liszt, Chopin, Schumann, Mendelssohn and Berlioz.
Late Romantic (c.1860 - c.1920)
With the honorable exceptions of Bruckner and Brahms, composers of this time shared a general tendency towards permitting their natural inspiration free rein, frequently pacing their compositions with more of their emotional content and dramatic continuity instead of organic structural growth. This was a period highlighted by the extraordinarily fast appearance of the national schools, and the operatic supremacy of Wagner and Verdi. The actual end of Romanticism came with fragmentation of this fundamental style, composers attending schools of composition, each together with a style which was in vogue for a little period of time.
Post 'Great War' Years (c.1920 - Present)
The time since the Great War is without any doubt the most bewildering of all, as composers have pulled in several apparently opposing and contradictory directions. Typical of this dilemma during the inter-war years, for example, were the Lehar, Austrians and Webern, the former was experimenting with the highly advanced and compressed form known as 'serial structure', while continually Lehar was yet indulging in an operetta style that would not have looked to be out of place for more than half a century beforehand.
So the styles adopted are diverse throughout the greater part of this recent century that only by experimentation could listeners discover by themselves if certain composers are to their real taste or not.
About Me
Dilip Tharuka
An undergraduate of University of Moratuwa Department of Computer Science and Engineering. A responsible person, always try to find the optimal solution for a given task, also an ambitious, energetic person about problem solving, learning new concepts, theories and technologies.
Popular Posts
-
" What Makes You Beautiful " is a song by the English-Irish boy band: One Direction. It was as their debut single and top single ...
-
It was 29 th October 2015, I joined to the Virtusa with ten other colleagues. We were warmly welcomed to Virtusa by HR department. Then w...
-
“Hotel California” was widely acclaimed to be one of the best musical creations in the history of music. It does not take an inquisitive ...
-
Here we refer to the various end user application system that are hosted on mainframe computers. As pointed out earlier, mainframes are...
-
In a temperate London restaurant, two people meet to talk about their marital challenges. They both agree that they need more ti...


