Month: December 2009

  • Algorithm Problem 2: Easy

    Algorithm Problem 2: Easy

    Algorithm Problem
    Algorithm Problem Solution

    Hey, try to solve this. This is an easy problem to solve.

    Problem Level: Easy

    Problem Statement:

    A palindrome is a word, number, or phrase that reads the same forwards as backwards. For example, the name “anna” is a palindrome. Numbers can also be palindromes (e.g. 151 or 753357).

    Additionally numbers can of course be ordered in size. The first few palindrome

    numbers are: 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, …

    The number 10 is not a palindrome (even though you could write it as 010) but a zero as leading digit is not allowed.

    Input:

    The input consists of a series of lines with each line containing one integer value i (1 ≤ i ≤2*109).

    This integer value i indicates the index of the palindrome number that is to be written to the output, where index 1 stands for the first palindrome number (1), index 2 stands for the second palindrome number (2) and so on. The input is terminated by a line containing 0.

    Output:

    For each line of input (except the last one) exactly one line of output containing a single (decimal) integer value is to be produced. For each input value i the i-th palindrome number is to be written to the output.

    Sample Input                                                 Output for Sample Input

    1                                                                    1
    12                                                                  33
    24                                                                  151

  • Algorithm Problem 1 : Med

    Algorithm Problem 1 : Med

    Alogrithm Problem
    Algorithm Problem

    This problem I got to solve on “Prodyogiki 09” in an University Competition of NITs. I was unable to solve that. Try to solve this.

    Problem Level: Med

    Problem statement: The world is at war. The machine have vowed to clear the human race and the human have determined to make machine extinct. You have been elected as leader of resistance. You need to destroy the Cyberdyne systems. In a bid to do so, u have launched an air attack on Cyberdine. This tasks is, like so many things, best accomplished by randomly blowing things up. Fortunately, you have a proven talent in this area.

    Even as we speak, your warplanes are dropping large bombs all over the machines. You need some way to determine  the extent of  the  carnage.  If  the pilots have  served you well,  they may  live  for  another precious day. You don’t really care about the property damage or the massive casualties. As such, all you want to know is the total area of devastation. Every bomb has a destruction radius. Anything within that radius  is completely eradicated. Computing the area for one bomb  is fairly simple, but for many  it  isn’t quite so easy. However, your human friends have surprisingly  large proportion of skilled programmers, so  you  have  respectfully  requested  their  assistance.  The  survivors  of  this  request  (ie,  those  who cooperated) are now hard at work, writing a program to solve this problem…

    Input 

    Input consists of a number of cases. Each case lists all of the bombs dropped on one day of your rule. The first line of case contains n, the number of bombs. The next n lines each contain the x and y coordinates where one bomb exploded, and its destruction radius. There will be at most 100 bombs. Coordinates given are real numbers between 0 and 100, and the radius is a real number between 0 and 10.

    There will be at most 50 cases. The last day of bombing will be followed by a line containing 0. This case must not be processed.

    Output 

    For each case, output the area of destruction from all of the bombs from that day, accurate to three decimal places.

     

    Sample Input Output for Sample Input 

    1
    0 0 10                     314.159

    2
    0 0 10
    0 10 10                    505.482

  • Welcome to My Blog!

    Welcome to My Blog!

    Hi,

    Welcome to my blog!

    I will try to post the content related to programming, algorithmic problems, systems administration, cloud computing. I’m creating this blog as a wayback machine of myself, to track which problems I faced during learning new technologies and what solutions did I find while solving them. Here you can expect some “Gyan”  – tutorials, problem fixes, procedure of installation, setting up system administration tasks etc.

    Currently I’m giving more attention towards algorithms part. Moreover I know 6e6f7468696e67,  but having tiny knowledge of C/C++, HTML / CSS, Java, Php, MySQL and some adobe products. I had just completed  BCA this year. Let’s learn more and have fun continued.  😉

    How about this quote:

    The greatest ignorance is to reject something you know nothing about.

    If I will find something interesting, then I will surely post in this blog. I hope you will also get benefitted the stuff I’m gonna post.