线段树好题,和 15 年的广东省省赛 C 题有相似之处,一开始我的思路有偏差,看了别人的博客后感觉处处技巧都是精华,主要是区间合并的技巧一时很难想到,先附上代码: #include<cstdio> #include<cstring> #include<algorithm> using namespace std; #define root int rt, int l, int r #define lson rt << 1, l, mid #define rs…
题意: 给定三种操作 1. add x 向序列中添加x,添加之后序列还保持有序 2. del x 删除序列中值为x的元素 3. sum 求下边模5等于3的元素和 思路: 直接暴力也可以过,就是看暴力写的好不好了.用数组直接暴力可过. 暴力代码: #include <cstdio> #include <cstring> #include <algorithm> using namespace std; ; typedef long long ll; int a[max…
题意: 三种操作: 1. add x – add the element x to the set;2. del x – remove the element x from the set;3. sum – find the digest sum of the set. The digest sum should be understood by:sum(ai) where i % 5 ==3 where the set S is written as {a1, a2, ... , ak} sa…
题意: 刚开始有一个空集合.有三种操作: 1.往集合中加入一个集合中不存在的数 x 2.从集合中删除一个已经存在的数 x 3.计算集合的digest sum并输出. digest sum求法:将集合中所有数从小到大排序,得到a1<a2<...<an. digest sum = sum(ai) where i mod 5 = 3 数据范围: N ( 1 <= N <= 105 ) 1 <= x <= 109. For any "add x&qu…
Coder Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4838 Accepted Submission(s): 1853 Problem Description In mathematics and computer science, an algorithm describes a set of procedures…
Xiangqi Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=4121 Description Xiangqi is one of the most popular two-player board games in China. The game represents a battle between two armies with the goal of captu…