POJ1050
来源:互联网 发布:网络商学院排名 编辑:程序博客网 时间:2024/05/21 17:45
题目:http://acm.pku.edu.cn/JudgeOnline/problem?id=1050
思路:穷举+动态规划
- import java.util.Scanner;
- public class Main {
- int[][] a;
- int l;
- int max = Integer.MIN_VALUE;
- int t;
- int t1;
- int t2[];
- public Main() {
- Scanner scan = new Scanner(System.in);
- l = scan.nextInt();
- a = new int[l][l];
- for (int i = 0; i < l; i++) {
- for (int j = 0; j < l; j++) {
- a[i][j] = scan.nextInt();
- }
- }
- search();
- System.out.println(max);
- }
- public void search() {
- for (int i = 0; i < l; i++) {
- for (int j = 0; j < l; j++) {
- t1 = 0;
- t2 = new int[l];
- for (int k = i; k < l; k++) {
- t1 += a[k][j];
- t = t1;
- if (t > max) {
- max = t;
- }
- for (int m = j + 1; m < l; m++) {
- t2[m] += a[k][m];
- t += t2[m];
- if (t > max) {
- max = t;
- }
- }
- }
- }
- }
- }
- public static void main(String[] args) {
- new Main();
- }
- }
- POJ1050
- poj1050
- POJ1050
- poj1050
- poj1050
- POJ1050
- poj1050
- poj1050
- poj1050
- POJ1050
- poj1050
- poj1050
- poj1050
- poj1050
- poj1050
- poj1050
- poj1050
- POJ1050 DP
- linux 内核参数调整说明
- EAM和ERP
- POJ1019
- POJ1028
- struts,spring,hibernate
- POJ1050
- ExtJS+DWR+Spring+Hibernate开发HRMS(1)
- 什么时候执行lsnrctl reload?
- 书签
- 开写
- ASP.NET跨页面传值技巧
- ORACLE listener监听设置密码
- Mongre cluster服务的安装与配置
- Oracle's alert.log