Codeforces Round #226 (Div. 2)A. Bear and Raspberry
/*
贪心的找到相邻两项差的最大值,再减去c,结果若是负数答案为0.
*/
1 #include <stdio.h>
#define maxn 105
int num[maxn];
int main()
{
int n,c;
while(~scanf("%d%d",&n,&c))
{
int ans = ;
for(int i = ;i < n;i++)
scanf("%d",num+i);
for(int i = ;i < n-;i++){
int temp = num[i] - num[i+];
if(temp > ans)
ans = temp;
}
ans -= c;
if(ans>=)
printf("%d\n",ans);
else
printf("0\n");
}
}
Codeforces Round #226 (Div. 2)A. Bear and Raspberry的更多相关文章
- Codeforces Round #226 (Div. 2)B. Bear and Strings
/* 题意就是要找到包含“bear”的子串,计算出个数,需要注意的地方就是不要计算重复. */ 1 #include <stdio.h> #include <string.h> ...
- Codeforces Round #226 (Div. 2)C. Bear and Prime Numbers
/* 可以在筛选质数的同时,算出每组数据中能被各个质数整除的个数, 然后算出[0,s]的个数 [l,r] 的个数即为[0,r]的个数减去[0,l]个数. */ #include <stdio.h ...
- 【计算几何】【状压dp】Codeforces Round #226 (Div. 2) D. Bear and Floodlight
读懂题意发现是傻逼状压. 只要会向量旋转,以及直线求交点坐标就行了.(验证了我这俩板子都没毛病) 细节蛮多. #include<cstdio> #include<algorithm& ...
- Codeforces Round #356 (Div. 2) C. Bear and Prime 100(转)
C. Bear and Prime 100 time limit per test 1 second memory limit per test 256 megabytes input standar ...
- Codeforces Round #356 (Div. 2)B. Bear and Finding Criminals(水题)
B. Bear and Finding Criminals time limit per test 2 seconds memory limit per test 256 megabytes inpu ...
- Codeforces Round #356 (Div. 2)A. Bear and Five Cards(简单模拟)
A. Bear and Five Cards time limit per test 2 seconds memory limit per test 256 megabytes input stand ...
- Codeforces Round #356 (Div. 1) D. Bear and Chase 暴力
D. Bear and Chase 题目连接: http://codeforces.com/contest/679/problem/D Description Bearland has n citie ...
- Codeforces Round #356 (Div. 2) E. Bear and Square Grid 滑块
E. Bear and Square Grid 题目连接: http://www.codeforces.com/contest/680/problem/E Description You have a ...
- Codeforces Round #356 (Div. 2) D. Bear and Tower of Cubes dfs
D. Bear and Tower of Cubes 题目连接: http://www.codeforces.com/contest/680/problem/D Description Limak i ...
随机推荐
- unity的旋转
绕着一个点旋转 : transform.RotateAround(Vector3.zero, Vector3.up, speed* Time.deltaTime ); 第一个参数,点的位置.第二个参数 ...
- LCA——倍增求解
LCA,即最近公共祖先,用于解决树上两点的最近公共祖先问题. ; lca(1,2)=3;(原谅我的绘画水平) LCA的求解有三种算法(我知道的)——tarjan,倍增,线段树(我只会两种),NOIp之 ...
- throw 与 throws的应用
throws---------->把异常交给调用处. 可以结合throw来同时使用. throws 用在方法声明处,表示本方法不处理异常.可以结合throw使用 throw 表示在方法中手工抛出 ...
- Storm技术结合
http://pan.baidu.com/s/1mhzj5XI?qq-pf-to=pcqq.group#path=%252F
- 过生日,也要学学哈,这次是SHELL的GETOPTS
今天是WEBSOCKET,, 先完成一个SHELL的GETOPS,周一就用得着. #!/bin/bash echo "usage: ./$0 -t (prism|opscripts)&quo ...
- MySQL表结构为InnoDB类型从ibd文件恢复数据
客户的机器系统异常关机,重启后mysql数据库不能正常启动,重装系统后发现数据库文件损坏,悲催的是客户数据库没有进行及时备份,只能想办法从数据库文件当中恢复,查找资料,试验各种方法,确认下面步骤可行: ...
- Eclipse导入git上的maven web项目 部署
1 Eclipse中导入Git的maven项目 方法1: (1)首先当然是拉代码. 在Eclipse里面有个Git Repositories Exploring.就是Git仓库,clone a git ...
- More on 1Password’s Components
Stefan van As of 1Password fame sent me a more exhaustive list of the libraries and tools used in 1P ...
- 关于checkbox的checked属性和change事件
jquery中的attr和prop有什么区别? To retrieve and change DOM properties such as the checked, selected, or disa ...
- tomcat docBase 和 path
<Context docBase="zjzc-web-api" path="/api" reloadable="false"/> ...