目录 Codeforces 1091 A.New Year and the Christmas Ornament B.New Year and the Treasure Geolocation C.New Year and the Sphere Transmission(思路) D.New Year and the Permutation Concatenation(思路 计数) E.New Year and the Acquaintance Estimation(Erdos–Gallai定理…
目录: B - Fraction D - Triangle F - Harmonic Value Description H - Sequence I I - Sequence II B题:HDU 5912 - Fraction - [递归] 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5912 Problem DescriptionMr. Frog recently studied how to add two fractions up, an…
E Find the median 题意:每次往序列中增加连续的[l,r]的数,每加入一次就询问当前序列的中位数. 解法:此题没有要求在线,那么直接离线+线段树+二分就可以了.求出每个端点之后排序得到数组b,线段树每个叶子结点i存储的是区间[ b[i-1]+1,b[i] ]的系数(即当前序列有多少个[ b[i-1]+1,b[i] ]).修改时顺便维护当前总的数个数sum,然后处理询问就是直接在线段树上二分就可以了. #include<bits/stdc++.h> #define lc o*2…
真心不知到里面写的具体什么意思,先记下吧. /*Our own header, to be included after all standard system headers*/ #ifndef __ourhdr_h #define __ourhdr_h #include <errno.h> /*for definition of errno */ #include <stdarg.h> /*ANSI C header file */ #include <sys/types…
B. Balanced Diet 思路:把每一块选C个产生的价值记录下来,然后从小到大枚举C. #include<bits/stdc++.h> using namespace std; ; typedef long long ll; vector<int> G[maxn]; int l[maxn], a[maxn], b[maxn]; ll dp[maxn]; bool cmp(int a, int b) { return a > b; } int main() { std:…