bzoj1668
来源:互联网 发布:广州980数控编程视频 编辑:程序博客网 时间:2024/06/14 00:35
做水题有助身心健康 :
细节处理
#include<bits/stdc++.h>using namespace std;inline int read(void) { int x = 0, c, f = 1; do {c=getchar();if(c=='-')f=-1;}while(c<'0'||c>'9'); do {x=x*10+c-'0';c=getchar();}while(c>='0'&&c<='9'); return x * f;}const int N = 110;int a[N][N], f[N][N], n, m;int main(){ n = read(), m = read(); for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) a[i][j] = read(); f[1][1] = a[1][1]; for (int j = 1; j < m; j++) for (int i = 1; i <= n; i++) if (f[i][j]){ f[i][j] += a[i][j]; f[i][j+1] = max(f[i][j+1], f[i][j]); f[i+1][j+1] = max(f[i+1][j+1], f[i][j]); f[i-1][j+1] = max(f[i-1][j+1], f[i][j]); } cout << f[n][m] + a[n][m] - a[1][1]<< endl; }
1 0
- bzoj1668
- [bzoj1668] Cow Pie Treasures
- bzoj1668 [Usaco2006 Oct]Cow Pie Treasures 馅饼里的财富
- bzoj1668 [Usaco2006 Oct]Cow Pie Treasures 馅饼里的财富
- bzoj1668 [Usaco2006 Oct]Cow Pie Treasures 馅饼里的财富(dp)
- 小马哥--高仿苹果7 主板型号 873AQ0A 真实6571芯片刷机 拆解图示
- USACO
- 打造ViewPager的通用适配器CommonPagerAdapter
- 深入理解javascript原型和闭包(1)——一切都是对象
- Notification的基本用法
- bzoj1668
- 读书笔记《Effective C++》条款18:让接口容易被正确使用,不易被误用
- 重构—改善既有代码的设计
- ListView 图片丢失,错位
- 隐式动画与显式动画
- LeetCode 70 Climbing Stairs(记忆化搜索)
- 深入理解javascript原型和闭包(2)——函数和对象的关系
- Python实现最简单的双人聊天程序
- JavaScript之安全作用域的构造函数(高级函数)