水题。http://community.topcoder.com/stat?c=problem_statement&pm=2923&rd=5854

一开始错了是因为理解错题意。还有就是初始化min应该设为Integer.MAX_VALUE,而不是相反。

public class TallPeople {
public int[] getPeople(String[] people) {
int min = Integer.MAX_VALUE;
int max = Integer.MIN_VALUE;
int len1 = people.length;
if (len1 == 0) return null;
String[] hgts = people[0].split(" ");
int len2 = hgts.length;
if (len2 == 0) return null;
int mx[][] = new int[len1][len2]; for (int i = 0; i < len1; i++) {
String line = people[i];
String[] heights = line.split(" ");
int _min = Integer.MAX_VALUE;
for (int j = 0; j < len2; j++) {
int tmp = Integer.parseInt(heights[j]);
mx[i][j] = tmp;
if (tmp < _min) _min = tmp;
}
if (_min > max) max = _min;
}
for (int j = 0; j < len2; j++) {
int _max = Integer.MIN_VALUE;
for (int i = 0; i < len1; i++) {
if (mx[i][j] > _max) _max = mx[i][j];
}
if (_max < min) min = _max;
} return new int[] {max, min};
}
}

  

[topcoder]TallPeople的更多相关文章

  1. TopCoder kawigiEdit插件配置

    kawigiEdit插件可以提高 TopCoder编译,提交效率,可以管理保存每次SRM的代码. kawigiEdit下载地址:http://code.google.com/p/kawigiedit/ ...

  2. 记第一次TopCoder, 练习SRM 583 div2 250

    今天第一次做topcoder,没有比赛,所以找的最新一期的SRM练习,做了第一道题. 题目大意是说 给一个数字字符串,任意交换两位,使数字变为最小,不能有前导0. 看到题目以后,先想到的找规律,发现要 ...

  3. TopCoder比赛总结表

    TopCoder                        250                              500                                 ...

  4. Topcoder几例C++字符串应用

    本文写于9月初,是利用Topcoder准备应聘时的机试环节临时补习的C++的一部分内容.签约之后,没有再进行练习,此文暂告一段落. 换句话说,就是本文太监了,一直做草稿看着别扭,删掉又觉得可惜,索性发 ...

  5. TopCoder

    在TopCoder下载好luncher,网址:https://www.topcoder.com/community/competitive%20programming/ 选择launch web ar ...

  6. TopCoder SRM 596 DIV 1 250

    body { font-family: Monospaced; font-size: 12pt } pre { font-family: Monospaced; font-size: 12pt } P ...

  7. 求拓扑排序的数量,例题 topcoder srm 654 div2 500

    周赛时遇到的一道比较有意思的题目: Problem Statement      There are N rooms in Maki's new house. The rooms are number ...

  8. TopCoder SRM 590

     第一次做TC,不太习惯,各种调试,只做了一题...... Problem Statement     Fox Ciel is going to play Gomoku with her friend ...

  9. Topcoder Arena插件配置和训练指南

    一. Arena插件配置 1. 下载Arena 指针:http://community.topcoder.com/tc?module=MyHome 左边Competitions->Algorit ...

随机推荐

  1. centos下 forever: 让nodejs应用后台执行

    在LINUX中我们可以使用这种简单的方式让node.js在后台运行: nohup node your_app.js & forever可以让我们做得更好,并且可以跨平台的在windows和Li ...

  2. How to: Change icon in Inno Setup

    1. Change the installer executable icon or the icon showed in Start Menu folder Using SetupIconFile ...

  3. cannot convert from '_TCHAR *' to 'char *'

    Reference: Why can't convert TCHAR* to char* Need to Use Multi-Byte Character Set in project's setti ...

  4. Convert CString to TCHAR

    Quote from: http://vctipsplusplus.wordpress.com/2008/05/21/cstring-to-tchar/ CString is a very usefu ...

  5. (转)RPC原理详解

    转自:http://www.open-open.com/lib/view/open1425797146897.html RPC功能目标 RPC的主要功能目标是让构建分布式计算(应用)更加容易,在提供强 ...

  6. Webstorm 配置与使用 Less

    * 安装完NodeJs * 将npm文件夹保存在C:\Users\Administrator\AppData\Roaming\下 * 在webStrom中,setting -> Tools -& ...

  7. Cassandra1.2文档学习(4)——分区器

    参考文档:http://www.datastax.com/documentation/cassandra/1.2/webhelp/index.html#cassandra/architecture/a ...

  8. C#实现登录窗口(不用隐藏)

    C#登录窗口的实现,特点就是不用隐藏,感兴趣的朋友不要错过 (1).在程序入口处,打开登录窗口 复制代码代码如下: static void Main()  {  Application.EnableV ...

  9. DB2实用命令记录

    quiesce tablespace quiesce tablespaces for table <table_name> share; Monitor Switches details ...

  10. Redhat 6 配置CentOS yum source

    由于最近曝出linux的bash漏洞,想更新下bash,于是 想到了配置CentOS yum source. 测试bash漏洞的命令: env x='() { :;}; echo "Your ...