![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
贪心
NineFailure
这个作者很懒,什么都没留下…
展开
-
求最大值....
这题讲道理这贪心策略我自我感觉良好…… 先从左边求最大,再从右边求最小 如果从左边找到了比右边还小的 那么久更新差值 反之同理 描述 给定n个数,a[1]到a[n],请你帮忙找出a[i] - a[j]的最大值,其中1 <= i < j <= n输入 第一行一个数T,表示一共有T组数据(T <= 20); 每组测试数据第一行一个整数n(2 <= n <= 10 ^ 5),表示接下来有n个原创 2016-07-15 17:31:36 · 387 阅读 · 0 评论 -
HDU5037 贪心
Problem DescriptionOnce upon a time, there is a little frog called Matt. One day, he came to a river.The river could be considered as an axis.Matt is standing on the left bank now (at position 0). He w原创 2016-10-14 00:30:46 · 349 阅读 · 0 评论 -
lightoj 1016 水贪心
#include<iostream>#include<cstdio>#include<memory.h>#include<cstdio>#include<algorithm>#include<map>using namespace std;int tu[50001];int n, k;int main(){ int T; cin >> T; int u =原创 2016-09-28 21:19:39 · 302 阅读 · 0 评论 -
Codeforces Round #322 (Div. 2)C
C. Developing Skills time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Petya loves computer games. Finally a game that he’s been waiting for原创 2017-02-09 17:40:01 · 240 阅读 · 0 评论 -
HDU3193
Summer again! Flynn is ready for another tour around. Since the tour would take three or more days, it is important to find a hotel that meets for a reasonable price and gets as near as possible! B原创 2017-03-14 10:28:33 · 554 阅读 · 0 评论 -
CodeForces - 767B
Finally! Vasya have come of age and that means he can finally get a passport! To do it, he needs to visit the passport office, but it’s not that simple. There’s only one receptionist at the passport of原创 2017-05-22 22:06:31 · 284 阅读 · 0 评论 -
CodeForces - 747D
The winter in Berland lasts n days. For each day we know the forecast for the average air temperature that day.Vasya has a new set of winter tires which allows him to drive safely no more than k days a原创 2017-05-17 21:47:53 · 385 阅读 · 0 评论 -
CodeForces - 705D (17/600)
Scott Lang is at war with Darren Cross. There are n chairs in a hall where they are, numbered with 1, 2, …, n from left to right. The i-th chair is located at coordinate xi. Scott is on chair number s原创 2017-06-15 09:59:47 · 402 阅读 · 0 评论 -
HDU6138(96/600)二分+贪心+hash
Problem Description The Eternal Fleet was built many centuries ago before the time of Valkorion by an unknown race on the planet of Iokath. The fate of the Fleet’s builders is unknown but their legac原创 2017-08-18 12:41:59 · 536 阅读 · 0 评论