logic - 能够解决 google code jam 问题集

标签 logic

<分区>

这不是作业问题,而是我想知道这是否是学习编程所需要的。我一直登录 TopCoder 并不是为了实际参与,而是为了基本了解问题是如何解决的。但据我所知,我不明白问题是什么以及如何将问题转化为可以解决它的算法。 刚才正好看到了正在中国举行的ACM ICPC 2010 全局总决赛。团队得到了问题集,其中之一是:

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.

现在我不知道在阅读问题集后应该解决什么问题。

还有一个来自 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

是否要求编程人员应该能够解决这类问题?

如果有人能帮助我解释 google code jam 问题集,我将不胜感激,因为我希望参加今年的 Code Jam,看看我是否能做些什么。

谢谢。

最佳答案

从困难问题入手是大错特错。许多世界总决赛的问题对于许多有经验的程序员来说太难了,因此对于新手来说也太难也就不足为奇了。

正如其他人所说,从更简单的问题开始。我假设您了解编程的基础知识并且可以使用至少一种编程语言编写代码。尝试 TopCoder 上的 Division-2 问题集和 ACM ICPC 的地区/资格赛。从 SPOJ、UVa 和 Project Euler(在线提供简单问题列表)等站点找出简单问题并解决它们。在解决问题时,还要阅读算法和计算机科学的基础知识。 TopCoder 是一个很好的资源,因为他们有很多教程和文章,还允许您查看其他人的解决方案。

恕我直言,要成为更好的程序员通常需要大量的练习学习。没有捷径。你不能假设你是某种可以直接参与并解决所有问题的英雄程序员。您只需要接受还有很长的路要走,并从头开始。

关于logic - 能够解决 google code jam 问题集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2228402/

相关文章:

c# - 为什么要使用成员变量?

php - 需要一些 PHP 逻辑来遍历一些 mysql 数据库结果

javascript - 如果找到没有字符串匹配则执行代码

sharepoint - 多个共享点列表中的单个图库(所有相同字段)

logic - 斑马谜题的真值表

多次递归调用函数

c - 在我的 Eclipse 中运行此 fork 代码时出错,并且此代码也存在一些概念混淆

logic - 如何使用异或门实现此功能?

PHP 数组 - 一个 'set where key=?' 类型的函数?

algorithm - 奶油沼泽拼图中的小 Sprite