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 ...
随机推荐
- I2C总线模拟(郭天祥视屏)
电路图 思路 1.向EEPROM中通过I2C总线写入一个字节 2.通过I2C总线读出写入的字节 3.如果写入和读出成功点亮发光二极管 程序 #include <REGX51.H> #def ...
- c# 获取MP3和AMR文件格式的时长
//网上摘录整理private long GetAMRFileDuration(string fileName) { ; FileStream fs = new FileStream(fileName ...
- swift版本hello
import UIKit class ViewController: UIViewController { @IBOutlet var button : UIButton? //var alertVi ...
- 用JavaScript获取一个超链接的绝对URL地址
对于Web程序员来说,处理简单的URL格式也许会成为一场噩梦.试想一下,一个网址里有很多组成部分都会影响你对它的解析方法: 是否以/字符开头 是否以//开头 是否以?号开头 是否以#号开头 …等等 当 ...
- c++ 内存泄露的检查
对于c++的内存泄露检测,除了我们自己手动检查以外,还可以使用c++中的函数来帮助我们检测, 如下代码: #include "stdafx.h" #include <stri ...
- [转载]Winform等待窗口的实现(附源代码)
在开发Winform程序的时候,经常会用到等待窗口(如网络通讯.数据库连接等需要一定时间来执行的操作),这样可以给用户提供更好的体验. 等待窗口的主要功能是一边执行需要等待的操作,一边显示一个等待界面 ...
- zoj 3757&&3758
3757一个模拟题,简单,但容易错: 3758 大素数判定就行: #include<cstdio> #include<cstring> #include<algorith ...
- top 10 js mvc
http://codebrief.com/2012/01/the-top-10-javascript-mvc-frameworks-reviewed/ http://www.iteye.com/new ...
- res\menu\main.xml:6: error: No resource identifier found for attribute 'showAsAction' in package 'com.xxx.xxxx'
res\menu\main.xml:6: error: No resource identifier found for attribute 'showAsAction' in package 'co ...
- easyui源码翻译1.32--ComboTree(树形下拉框)
前言 扩展自$.fn.combo.defaults和$.fn.tree.defaults.使用$.fn.combotree.defaults重写默认值对象.下载该插件翻译源码 树形下拉框结合选择控件和 ...