本题的关键是从可选择方法中选择哪一类最优化 答案是结束时间最早的一类 源代码 #include<iostream>#include<algorithm>#include<cstdio>#define maxn 100100using namespace std;struct w{ int endd, ...
分类:
其他好文 时间:
2020-05-29 13:27:58
阅读次数:
55
假设有 $n$ 根柱子,现要按下述规则在这 $ n $ 根柱子中依次放入编号为 $ 1, 2, 3, 4, \cdots $ 的球。
1. 每次只能在某根柱子的最上面放球。
2. 在同一根柱子中,任何 $2$ 个相邻球的编号之和为完全平方数。
试设计一个算法,计算出在 $ n $ 根柱子上最... ...
分类:
其他好文 时间:
2020-05-28 23:38:44
阅读次数:
87
http://acm.hdu.edu.cn/showproblem.php?pid=2689 #include<bits/stdc++.h> #define low(x) (x&(-x)) using namespace std; const int maxn=1e5+5; typedef long ...
分类:
编程语言 时间:
2020-05-28 13:40:31
阅读次数:
88
A题王博文: https://blog.csdn.net/Kotsg/article/details/106396949 E题 苏用: https://www.cnblogs.com/yishuda/p/12977527.html F题 徐光旭: https://blog.csdn.net/xgx9 ...
分类:
其他好文 时间:
2020-05-28 13:12:32
阅读次数:
81
https://ac.nowcoder.com/acm/problem/20861 #include<bits/stdc++.h> #define low(x) (x&(-x)) using namespace std; const int N=1e5+5; typedef long long ll ...
分类:
编程语言 时间:
2020-05-28 11:36:20
阅读次数:
78
POJ 1740 先手必败状态为 偶数堆且为从小到大排序后(1,2)相等,(3,4)相等...,可以理解为每一堆都有与它对称的一堆解释:在这种情况下,先手无论什么操作,后手都可以执行对称的操作,从而维持先手必败状态,而且总数量是减少的,所以先手必败 其他状态都是先手必胜状态 如果为奇数堆解释:先从小 ...
分类:
其他好文 时间:
2020-05-28 10:27:01
阅读次数:
72
这个问题可以重新表述为: 给你 \(n\) 个区间 \([a_i, b_i]\),$1 \le a_i \le b_i \le n$。 这里,区间 \([l, r]\) 指的是正整数集合 \(\\{l, l+1, \dots, r\\}\)。 从第$i$个区间中取一个数 \(x_i\),也就是说要求 ...
分类:
其他好文 时间:
2020-05-28 00:40:52
阅读次数:
74
题意:给你一组全是$2^d\ (d\ge0)\(的数,询问q次,每次询问一个数,问这个数是否能够由原数组中的数相加得到,如果能,输出最少用多少个数,否则输出\)-1$. 题解:首先贪心得出结论:如果情况成立,那么最少的情况一定是优先用数组中大的数,然后我们用桶记录数组数的个数,从$inf$开始枚举, ...
分类:
其他好文 时间:
2020-05-27 15:19:08
阅读次数:
49
学习博客:https://blog.csdn.net/sun_shine9112/article/details/105822859 问题 相容问题,解析时给出其他几种贪心策略(如按开始时间从小到大、每个活动时间的占用时间等),并给出这些贪心策略无法实现最优的反例。 解析 二分归并排序采用了分治的思 ...
分类:
其他好文 时间:
2020-05-27 13:44:46
阅读次数:
73
package com.lzl.service; import com.github.pagehelper.PageInfo;import com.lzl.pojo.Mingxi;import com.lzl.pojo.Wuliao; public interface MingxiService { ...
分类:
其他好文 时间:
2020-05-27 12:24:43
阅读次数:
64