Codeforces 496A Minimum Difficulty(暴力)
2015-11-10 13:14
363 查看
题目链接:Codeforces 496A Minimum Difficulty
代码
#include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int maxn = 105; int main () { int n, a[maxn], ans = 0, tmp = 0x3f3f3f3f; scanf("%d", &n); for (int i = 1; i <= n; i++) scanf("%d", &a[i]); for (int i = 1; i < n; i++) ans = max(ans, a[i+1] - a[i]); for (int i = 2; i < n; i++) tmp = min(tmp, a[i+1] - a[i-1]); printf("%d\n", max(tmp, ans)); return 0; }
相关文章推荐
- POJ1004 Financial Management
- 百超激光 镭射 bysoft6.8.1软件
- 页面加载完毕后滚动到指定位置
- mysql select in 按照in后面id的顺序读取数据
- iOS常见问题总结(一)
- 大数据架构和模式(四)了解用于大数据解决方案的原子模式和复合模式 大数据架构和模式(五)对大数据问题应用解决方案模式并选择实现它的产品
- c++ 初始化两个vector对象,
- 能用微信控制的插座SmartSwitch 0.1 开源手册
- MYSQL问题:You can't specify target table '表名' for update in FROM clause
- nodejs gyp WARN EACCES user "root" does not have permission to access the dev dir
- 大数据架构和模式(一)大数据分类和架构简介 大数据架构和模式(二)如何知道一个大数据解决方案是否适合您的组织
- HDU5253(最小生成树)
- 一个好玩的计算题目(c++ 位运算)
- Ubuntu下配置samba服务器
- 为什么需要日志审计系统
- 中国安卓
- 关于js中单引号(')和双引号(")的使用以及转义的理解
- SAP FICO hande汉得培训资料---II 应收模块篇 PDF 电子版
- 用户故事
- post方式发送接收文件