poj 3176Cow Bowling DP
来源:互联网 发布:淘宝店铺能不能转让 编辑:程序博客网 时间:2024/05/29 10:07
//简单数字三角形,大水体,现在才做到,不过还是去AC他了
#include<iostream>
#include<cmath>#include<cstring>
#include<cstdio>
#include<algorithm>
#include<string>
#include<stack>
#include<queue>
#include<map>
#define PI acos(-1.0)
typedef long long LL;
const int MAX=0xfffffff;
using namespace std;
int a[400][400],dp[400][400];
int main( )
{
//freopen("1.txt","r",stdin);
int n;
while(scanf("%d",&n)!=EOF)
{
memset(a,0,sizeof(a));
for(int i=1;i<=n;i++)
for(int j=1;j<=i;j++)
scanf("%d",&a[i][j]);
memset(dp,0,sizeof(dp));
int ans=-MAX;
for(int i=1;i<=n;i++)
for(int j=1;j<=i;j++)
{
dp[i][j]=max(dp[i-1][j-1],dp[i-1][j])+a[i][j];
if(i==n) ans=max(ans,dp[i][j]);
}
printf("%d\n",ans);
}
return 0;
}
0 0
- POJ 3176 Cow Bowling DP
- poj-3176-Cow Bowling-dp
- poj 3176 Cow Bowling (DP)
- poj 3176 Cow Bowling dp
- POJ 3176 Cow Bowling DP
- poj 3176Cow Bowling DP
- Poj 3176 Cow Bowling【dp】
- POJ 3176 Cow Bowling (dp)
- poj 3176 -- Cow Bowling (dp)
- POJ 3176 Cow Bowling (简单DP)
- POJ 3176 Cow Bowling (简单DP)
- poj 3176 Cow Bowling 数塔dp
- POJ 3176-Cow Bowling (简单DP)
- POJ 3176 Cow Bowling (简单DP)
- POJ 3176 Cow Bowling (dp)
- POJ 3176 Cow Bowling(dp)
- POJ 3176 Cow Bowling(DP 数字三角形)
- POJ 3176 Cow Bowling(简单DP)
- 杭电2079 选课时间(母函数)
- Eclipse下的插件tomcat和桌面的tomcat下的项目不对应问题
- 更改Scala的代码自动补全快捷键code completion
- hdu 3177_贪心
- Webmin下SSL登录设置
- poj 3176Cow Bowling DP
- impala-jdbc-example-run
- 感想 --1
- android 中图片的压缩处理
- javascript实现ie6兼容position:fixed
- impala-jdbc-example-pom
- Android 简单录音程序
- 【Android】launcher启动参数
- XML 解析开源框架,未完待续