CCF 201612-1 最大波动 (水题)
第二行包含n个正整数,依次表示每天的收盘价格。
2 5 5 7 3 5
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <cstring>
#include <set>
#include <queue>
#include <algorithm>
#include <vector>
#include <map>
#include <cctype>
#include <cmath>
#include <stack>
#define freopenr freopen("in.txt", "r", stdin)
#define freopenw freopen("out.txt", "w", stdout)
using namespace std; typedef long long LL;
typedef pair<int, int> P;
const int INF = 0x3f3f3f3f;
const double inf = 0x3f3f3f3f3f3f;
const double PI = acos(-1.0);
const double eps = 1e-8;
const int maxn = 1e5 + 5;
const int mod = 1e9 + 7;
const int dr[] = {-1, 1, 0, 0};
const int dc[] = {0, 0, 1, -1};
const char *de[] = {"0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111"};
int n, m;
const int mon[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int monn[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
inline int Min(int a, int b){ return a < b ? a : b; }
inline int Max(int a, int b){ return a > b ? a : b; }
inline LL Min(LL a, LL b){ return a < b ? a : b; }
inline LL Max(LL a, LL b){ return a > b ? a : b; }
inline bool is_in(int r, int c){
return r >= 0 && r < n && c >= 0 && c < m;
} int main(){
while(cin >> n){
int pre;
cin >> pre;
int ans = 0;
for(int i = 1; i < n; ++i){
cin >> m;
ans = Max(ans, (int)abs(m - pre));
pre = m;
}
printf("%d\n", ans);
}
return 0;
}
CCF 201612-1 最大波动 (水题)的更多相关文章
- CCF 201409-1 相邻数对 (水题)
问题描述 给定n个不同的整数,问这些数中有多少对整数,它们的值正好相差1. 输入格式 输入的第一行包含一个整数n,表示给定整数的个数. 第二行包含所给定的n个整数. 输出格式 输出一个整数,表示值正好 ...
- HDOJ 2317. Nasty Hacks 模拟水题
Nasty Hacks Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tota ...
- ACM :漫漫上学路 -DP -水题
CSU 1772 漫漫上学路 Time Limit: 1000MS Memory Limit: 131072KB 64bit IO Format: %lld & %llu Submit ...
- ytu 1050:写一个函数,使给定的一个二维数组(3×3)转置,即行列互换(水题)
1050: 写一个函数,使给定的一个二维数组(3×3)转置,即行列互换 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 154 Solved: 112[ ...
- [poj2247] Humble Numbers (DP水题)
DP 水题 Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The se ...
- gdutcode 1195: 相信我这是水题 GDUT中有个风云人物pigofzhou,是冰点奇迹队的主代码手,
1195: 相信我这是水题 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 821 Solved: 219 Description GDUT中有个风云人 ...
- BZOJ 1303 CQOI2009 中位数图 水题
1303: [CQOI2009]中位数图 Time Limit: 1 Sec Memory Limit: 162 MBSubmit: 2340 Solved: 1464[Submit][Statu ...
- 第十一届“蓝狐网络杯”湖南省大学生计算机程序设计竞赛 B - 大还是小? 字符串水题
B - 大还是小? Time Limit:5000MS Memory Limit:65535KB 64bit IO Format: Description 输入两个实数,判断第一个数大 ...
- ACM水题
ACM小白...非常费劲儿的学习中,我觉得目前我能做出来的都可以划分在水题的范围中...不断做,不断总结,随时更新 POJ: 1004 Financial Management 求平均值 杭电OJ: ...
随机推荐
- 数据库 MySql
MySql 一,概述 1,什么是数据库? 数据的仓库,如:在ATM的示例中我们创建了一个 db 目录,称其为数据库 二,下载安装 想要使用MySQL来存储并操作数据,则需要做几件事情: a. 安装My ...
- No.2__C#
几经波折——多事之秋的第二周 这周的事情还有点多, 应该已经是上周了确切的说.总的来说,上周的数据结构的学习进行的很顺利.最让自己惊喜的是,居然很快就派上了用场,这也坚定了我学习的信念,极大地鼓舞了我 ...
- javascript--关于错误
错误是一定会发生,所以语言都会有自己的错误处理机制.javascript的错误处理机制,关乎throw.try.catch. try 语句允许我们定义在执行时进行错误测试的代码块. catch 语句允 ...
- HDOJ2222 Keywords Search-AC自动机
Problem Description In the modern time, Search engine came into the life of everybody like Google, B ...
- 纸上谈兵:左倾堆(leftist heap)
作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明.谢谢! 我们之前讲解了堆(heap)的概念.堆是一个优先队列.每次从堆中取出的元素都是堆中 ...
- Android Service 文档
应用场景: 1 用于将后台逻辑(Service中)和UI逻辑(Activity中)进行解耦,实现Service功能的复用,为其他程序提供功能. 2 后台功能,由于Activity在进入后台时(On ...
- threadlocal类
1.threadlocal对象为线程提供变量的副本,该副本为线程私有的,其它线程访问不到: 2.变量的副本存储在ThreadLocalMap对象中: 3.使用threadlocal时候,最好先使用in ...
- 开发中model,entity和pojo的区别
Entity接近原始数据,Model接近业务对象- Entity:是专用于EF的对数据库表的操作, Model:是为页面提供数据和数据校验的,所以两者可以并存 POJO:POJO是Plain Ordi ...
- List集合转换为数组形式
通过List集合对象的转类型函数 .ToArray() 如List<decimal> → deciaml[] 代码如下: var ComIdList = ComList.Select(p ...
- 使用fastcgi_finish_request提高页面响应速度
当PHP运行在FastCGI模式时,PHP FPM提供了一个名为fastcgi_finish_request的方法. 按照文档上的说法,此方法可以提高请求的处理速度,如果有些处理可以在页面生成完后再进 ...