views:

539

answers:

5

This is not a homework question, but rather my intention to know if this is what it takes to learn programming. I keep loggin into TopCoder not to actually participate but to get the basic understand of how the problems are solved. But to my knowledge I don't understand what the problem is and how to translate the problem into an algorithm that can solve it. Just now I happen to look at ACM ICPC 2010 World Finals which is being held in china. The teams were given problem sets and one of them is this:

Given at most 100 points on a plan with distinct x-coordinates,
   find the shortest cycle that passes through each point exactly once, 
   goes from the leftmost point always to the right until it reaches the 
   rightmost point, then goes always to the left until it gets back to the 
   leftmost point. Additionally, two points are given such that the the path
   from left to right contains the first point, and the path from right to 
   left contains the second point. This seems to be a very simple DP: after 
   processing the last k points, and with the first path ending in point a 
   and the second path ending in point b, what is the smallest total length
   to achieve that? This is O(n^2) states, transitions in O(n). We deal 
   with the two special points by forcing the first path to contain the first 
   one, and the second path contain the second one.

Now I have no idea what I am supposed to solve after reading the problem set.

and there's an other one from google code jam:

    Problem

        In a big, square room there are two point light sources: 
one is red and the other is green. There are also n circular pillars.

        Light travels in straight lines and is absorbed by walls and pillars. 
    The pillars therefore cast shadows: they do not let light through. 
    There are places in the room where no light reaches (black), where only 
    one of the two light sources reaches (red or green), and places where 
    both lights reach (yellow). Compute the total area of each of the four
     colors in the room. Do not include the area of the pillars.

        Input

            * One line containing the number of test cases, T.

        Each test case contains, in order:

            * One line containing the coordinates x, y of the red light source.
            * One line containing the coordinates x, y of the green light source.
            * One line containing the number of pillars n.
            * n lines describing the pillars. Each contains 3 numbers x, y, r. 
    The pillar is a disk with the center (x, y) and radius r.

        The room is the square described by 0 ≤ x, y ≤ 100. Pillars, room 
    walls and light sources are all disjoint, they do not overlap or touch. 

Output

For each test case, output:

Case #X:
black area
red area
green area
yellow area

Is it required that people who program should be should be able to solve these type of problems?

I would apprecite if anyone can help me interpret the google code jam problem set as I wish to participate in this years Code Jam to see if I can do anthing or not.

Thanks.

+2  A: 

You should start with much easier problems. Try looking for regionals, or even get the problems from the local schools contest. You need to have a large view of general programming, from data structures to algorithms. Master a basic programming language, one that the answers are accepted.

Pentium10
much easier problems like? this problem set is the starting one in code jam
JPro
here is a simple(r) problem, convert Arab numbers in Roman numbers eg: 10 in X, 2010 into MMX, then write this reversed Roman to Arab XLIX to 49
Pentium10
A: 

You cannot start learning programming by doing competitions. If you don't know any programming at all, the first programs you will write are things like "hello world", fibonacci and ackermann. Starting with things like TopCoder is like learning to drive using a formula one car. It doesn't work that way.

JesperE
A: 

U are very right JesperE. JPRO, Go back to the basics and get it settled from there. Your ability to compete and win programing contests depends on just 2 things:

  1. Your deep understanding of the language you are using and
  2. You mental flexibility with the language.
Sam
A: 

In short, you have to know some basic techniques that are used to develop this kinds of problems. Knowing dynamic programming, backtracking algorithms, searching, etc, helps you a lot when solving the problems.

This one from Google Code Jam is actually pretty hard, and involves computational geometry algorithms. How to solve it is detailed here: http://code.google.com/codejam/contest/dashboard?c=311101#s=a&a=5

caiokf
+1  A: 

It is a big mistake to start from hard problems. Many World Finals problems are too hard for lots of experienced programmers, so it is no surprise that it is also too hard for someone new.

As others have said, start with much easier problems. I am assuming you know the basics of programming and can write code in at least one programming language. Try problems from Division-2 problemsets on TopCoder, and Regional/Qualifying rounds of ACM ICPC. Find out the easy problems from sites like SPOJ, UVa and Project Euler (there are lists of easy problems available online) and solve them. As you solve, also read up on the basics of algorithms and computer science. TopCoder is a great resource since they have lots of tutorials and articles and also allow you to view other people's solutions.

IMHO, becoming a better programmer in general takes a lot of practice and study. There is no shortcut. You cannot assume that you are some sort of hero programmer who can just jump in and solve everything. You just have to accept that there is a long way to go, and start at the beginning.

MAK