poj-3176Cow Bowling
来源:互联网 发布:excel表重复数据筛选 编辑:程序博客网 时间:2024/06/07 12:02
奶牛保龄球:金字塔形的保龄球中从顶往下撞击,每次只能撞击左下或右下两个,求所有撞到得分的最高值。
dp:dp[i][j]=max(d[i+1][j],dp[i+1][j+1])+m[i][j];
#include<cstdio>#include<iostream>using namespace std;int ma(int x,int y){ if(x>y) return x; else return y;}int main(){ int dp[355][355],m[355][355]; int n; scanf("%d",&n); for(int i=0;i<n;i++) for(int j=0;j<=i;j++) { scanf("%d",&m[i][j]); } for(int i=n-1,j=0;j<=i;j++) { dp[i][j]=m[i][j]; //cout<<dp[i][j]<<endl; } for(int i=n-1;i>=0;i--) for(int j=0;j<=i;j++) dp[i][j]=ma(dp[i+1][j],dp[i+1][j+1])+m[i][j]; printf("%d",dp[0][0]); return 0;}
阅读全文
0 0
- POJ 3176 COW BOWLING
- POJ 3176 Cow Bowling
- poj 3176 Cow Bowling
- POJ 3176 Cow Bowling
- Poj 3176 Cow Bowling
- POJ 3176 Cow Bowling
- poj 3176 Cow Bowling
- poj 3176 Cow Bowling
- POJ 3176 Cow Bowling
- POJ 3176 Cow Bowling
- poj 3176 cow bowling
- POJ 3176 Cow Bowling
- POJ 3176 Cow Bowling
- POJ 3176 Cow Bowling
- poj 3176 Cow Bowling
- poj 3176 Cow Bowling
- POJ 3176 Cow Bowling
- poj 3176 Cow Bowling
- 构造n个成对括号
- 写给喜欢互联网技术的机械类学生
- Shell系列—/etc/init.d/functions详解
- mysql启动及sql的优化
- 0-1背包问题常见问题的总结
- poj-3176Cow Bowling
- oracle 查询数据库中所有表名及查询某一个表的所有列名
- 位,字,字节的区别
- JavaWeb使用SQL Server驱动的JDBC(1)
- Android Studio无法真机调试
- 基于阿里云产品的全链路评估
- plsql查询数据显示为乱码解决方法
- java中this详解
- Wireshark的使用