TopCoder比赛简介
来源:互联网 发布:php 图片转字节流 编辑:程序博客网 时间:2024/05/21 09:21
必要准备
要参加比赛,需要一些准备工作要做。
首先,需要注册成为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
- 球员比赛属性说明与日程简介
- 比赛简介、参赛须知、时间要求
- 比赛
- 比赛
- [Python] Visual Studio 2008 集成 IronPython 开发环境
- 利用xcode生成的app生成可以在iphone和itouch上运行的ipa安装包
- c # radiobutton
- Android多语言与国际化
- Excel 怎么想除
- TopCoder比赛简介
- 125条常见的java面试笔试题大汇总
- vim 配置文件
- 想不到装个Oracle会出这个错UnsupportedClassVersionError
- 傅里叶变换的物理意义
- excel ado 方式
- linux nfs配置
- 添加的控件变量所起到的作用
- 自动化测试的发展趋势