传送门 首先减的顺序是无关紧要的,那么有一个显然的贪心 每次减都减最大或者最小的,因为如果不这样操作,最大的差值不会变小 那么直接把序列排序一下然后模拟一下操作过程即可,别一次只减 $1$ 就好 ...
分类:
其他好文 时间:
2019-10-15 10:04:19
阅读次数:
84
E. Minimizing Difference 【思路】:其实不难发现这个题目,问的是max与min的差值,给了k次操作,我们可以这样考虑一旦一个数变成了下一个数,那么你每次花费的操作就会增加,所以我们只要考虑把最小值变大或者最大值变小,看哪个花费更小,就选择变化哪个,如果一次变化1的话,那么肯定 ...
分类:
其他好文 时间:
2019-10-15 00:04:08
阅读次数:
107
This time you are asked to tell the difference between the lowest grade of all the male students and the highest grade of all the female students. Inp ...
分类:
其他好文 时间:
2019-10-13 10:40:26
阅读次数:
89
Whats the difference between Pooled vs Unpooled and Direct vs Heap in ByteBuf? Like , what does pooled means in context of a message received , becaus ...
分类:
Web程序 时间:
2019-10-12 20:49:29
阅读次数:
194
1218 Longest Arithmetic Subsequence of Given Difference 最长定差子序列 问题描述 给你一个整数数组 和一个整数 ,请你找出 中所有相邻元素之间的差等于给定 的等差子序列,并返回其中最长的等差子序列的长度。 示例 1: 输入 :arr = [1, ...
分类:
其他好文 时间:
2019-10-12 11:27:48
阅读次数:
112
描述 Given a sequence, we define the seqence's value equals the difference between the largest element and the smallest element in the sequence. As an e ...
分类:
其他好文 时间:
2019-10-08 14:34:06
阅读次数:
73
题目如下: A Stepping Number is an integer such that all of its adjacent digits have an absolute difference of exactly 1. For example, 321 is a Stepping Nu ...
分类:
其他好文 时间:
2019-10-07 09:33:56
阅读次数:
80
1 typedef long long ll; 2 typedef pair<int,int> P; 3 #define _for(i,a,b) for(register int i = (a);i < b;i ++) 4 #define _rep(i,a,b) for(register int i... ...
分类:
其他好文 时间:
2019-10-06 15:10:43
阅读次数:
74
差分约束 截取到的一个博客 (只截取了我觉得好的部分): 1、数形结合 如若一个系统由n个变量和m个不等式组成,并且这m个不等式对应的系数矩阵中每一行有且仅有一个1和 1,其它的都为0,这样的系统称为差分约束( difference constraints )系统。引例中的不等式组可以表示成如图三 ...
分类:
其他好文 时间:
2019-10-06 09:50:02
阅读次数:
101
集合 只保留下来唯一的元素 {123, 456, 789} 集合的操作1.并集:union、| 2.交集:intersection、&3.差:difference、-4.子集:issubset ...
分类:
其他好文 时间:
2019-10-05 20:14:10
阅读次数:
92