惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

I
Intezer
V
Vulnerabilities – Threatpost
Google Online Security Blog
Google Online Security Blog
T
The Exploit Database - CXSecurity.com
C
CXSECURITY Database RSS Feed - CXSecurity.com
AWS News Blog
AWS News Blog
G
GRAHAM CLULEY
P
Privacy & Cybersecurity Law Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
Cybersecurity and Infrastructure Security Agency CISA
N
News | PayPal Newsroom
T
Tenable Blog
Spread Privacy
Spread Privacy
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
S
Secure Thoughts
P
Privacy International News Feed
IT之家
IT之家
Project Zero
Project Zero
T
The Blog of Author Tim Ferriss
Engineering at Meta
Engineering at Meta
大猫的无限游戏
大猫的无限游戏
博客园_首页
GbyAI
GbyAI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
量子位
雷峰网
雷峰网
Apple Machine Learning Research
Apple Machine Learning Research
Hacker News: Ask HN
Hacker News: Ask HN
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
N
Netflix TechBlog - Medium
Martin Fowler
Martin Fowler
NISL@THU
NISL@THU
I
InfoQ
D
DataBreaches.Net
有赞技术团队
有赞技术团队
K
Kaspersky official blog
Security Latest
Security Latest
The Register - Security
The Register - Security
Hugging Face - Blog
Hugging Face - Blog
S
Security @ Cisco Blogs
P
Proofpoint News Feed
M
MIT News - Artificial intelligence
H
Hackread – Cybersecurity News, Data Breaches, AI and More
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
AI
AI
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
Security Archives - TechRepublic
Security Archives - TechRepublic
N
News and Events Feed by Topic

博客园 - xmx

Amazon 2面杯具 N皇后回溯 "中航文化杯" 2007 ACM/ICPC 国际大学生程序设计竞赛亚洲区域赛(南京) 一个用来练dfs的简单迷宫问题 pku 1662 还是找规律的 pku 1806 Manhattan 2025(找规律) 今天西华的比赛,啥都不说啦,相当的nice!~~~ 今天北京赛区的比赛 pku 1505 copying books(DP) 最近看的一些东西 The 2007 ACM Asia Programming Contest Changchun Site Internet Preliminary Contest nice 位运算果真是好东西,今天算是学到点啦^_^ FOJ月赛-2007年9月 pku 1850 前面一直没注意到某个不规范的情况,导致结果一直比标准的大...调了好久... 终于有算最长重复子串(数)的后缀数组啦,nice The 2007 ACM Asia Programming Contest - Nanjing Preliminary pku 3219 人家居然用几十B就过了,肯定有超强的规律,可是我自己找了个,挂了...只能老实算... 一道双向dp,差点超时^_^||| N和素数P,求杨辉三角第N行中能被P整除的数的个数
dp pku 1050
xmx · 2007-09-20 · via 博客园 - xmx

#include <iostream>
using namespace std;

int n,i,j,k;
int a[101][101],s[101][101][101];
long b,sum,result;

int main()
{
 while(cin>>n&&n!=EOF)
 {
  for(i=1;i<=n;i++)
   for(j=1;j<=n;j++)
    {
       cin>>a[i][j];
       s[i][i][j]=a[i][j];
    }
  for(i=1;i<n;i++)
   for(j=i+1;j<=n;j++)
    for(k=1;k<=n;k++)
     s[i][j][k]=s[i][j-1][k]+a[j][k];//对于从第i到第j行的第k列的值
 
  result=0;
  for(i=1;i<=n;i++)
   for(j=1;j<=n;j++)
   {
    sum=0;
    b=0;
    for(k=1;k<=n;k++)//dp 就一维的
    {
     if(b>0)b+=s[i][j][k];
     else b=s[i][j][k];
     if(b>sum)sum=b;
    }
    if(sum>result)result=sum;
   }
  cout<<result<<endl;
 }
 return 0;
}