TopCoder比赛简介
来源:互联网 发布:linux内核移植教程 编辑:程序博客网 时间:2024/05/01 17:00
必要准备
要参加比赛,需要一些准备工作要做。
首先,需要注册成为TopCoder成员,这没什么好介绍的,大家填写相关内容就得了,注册网址Registration
其次,下载安装必要的软件-TopCoder Arena(竞技场,古罗马的斗兽场也是这个词),TopCoder Arena是一个纯Java应用程序,它既是Applet也是应用程序,所以需要安装Java运行环境。相关软件的网址ContestAppletProd.jnlp(Java Web Start 方式安装)
再次,启动TopCoder Arena>登录进入,就可以开始参加比赛了。
比赛概况
每年TopCoder都会有几个编程竞赛和锦标赛,参赛者被分成很多小组,进行一个或多个回合有时间限制的比赛。在每个回合,参赛者必须编写代码来解决三个不同难度的问题。你可以在TopCoder Arena里进行编辑,编译和测试。一个典型的问题包含一个必要的方法说明,几段用于描述问题的文字和一个说明性的实例子。在TopCoder Arena里,你可以看到过去真实的问题。下面是一个中等难度的问题:
-----------------------------------------------------------------------
Problem Statement
We want to display a two-color pattern on a rectangular array of pixels, with k of the pixels in the foreground color. We want to choose the pattern so that it minimizes the boundary between the foreground and the background.
The length of the boundary is the number of vertical and horizontal pixel edges that separate a foreground pixel from a background pixel. For example, this picture shows a rectangular array with three rows and six columns that has 5 foreground pixels (indicated by 'X'). The boundary in this case has length equal to 6: the upper left X is adjacent to 1 background pixel, the upper middle X is adjacent to 1, the rightmost X is adjacent to 3, the lower left X is adjacent to 0, and the lower right X is adjacent to 1.
- - - - - -
X X X - - -
X X - - - -
Create a class Coherence that contains the method minBndry that takes three int inputs, numRows (the height of the array), numCols (the width of the array), and k (the number of foreground pixels), and returns the length of the minimum possible boundary.
Definition
Class:
Coherence
Method:
minBndry
Parameters:
int, int, int
Returns:
int
Method signature:
int minBndry(int numRows, int numCols, int k)
(be sure your method is public)
Constraints
-
numRows is between 1 and 30 inclusive
-
numCols is between 1 and 30 inclusive
-
k is between 0 and numRows*numCols inclusive
Examples
0)
6
6
5
Returns: 5
X X X - - -
X X - - - -
- - - - - -
- - - - - -
- - - - - -
- - - - - -
The upper right foreground pixel has 2 boundary edges, the bottom right one has 2 boundary edges, and the bottom left one has 1 boundary edge.
1)
4
6
16
Returns: 4
X X X X - -
X X X X - -
X X X X - -
X X X X - -
2)
9
5
0
Returns: 0
---------------------------------------------------------------------
- TopCoder比赛简介
- TopCoder比赛简介
- topcoder 第一次比赛
- TopCoder简介
- Linux下TopCoder比赛准备
- 小朋友学TopCoder(1):TopCoder简介
- 如何在Topcoder上进行比赛
- 如何在topcoder上进行算法比赛
- TopCoder
- topcoder
- Topcoder
- topcoder
- topcoder
- Topcoder
- 球员比赛属性说明与日程简介
- 比赛简介、参赛须知、时间要求
- 比赛
- 比赛
- JDK中的动态代理
- delphi类消息的处理机制
- 部分基金公司的一些“招牌”基金
- 网络创业者莱恩-福克斯:最后一分钟的奇迹
- 有没人告诉你,是天堂还是地狱?
- TopCoder比赛简介
- 关于c与qt界面连接的思路,--工作总结
- 最大乘积问题(NOIP原题)
- Solaris内核中的中断接口
- fedora7 adsl设置成功!有问题的进来参考下!!
- asp.net 获取当前目录的几个方法
- java Swing 自动视感包
- Solaris,Linux和FreeBSD内核的比较
- hibernate3学习系列文章的地址列表