B. Shopping 题目连接: http://www.codeforces.com/contest/665/problem/B Description Ayush is a cashier at the shopping center. Recently his department has started a ''click and collect" service which allows users to shop online. The store contains k items.…
F. Four Divisors 题目连接: http://www.codeforces.com/contest/665/problem/F Description If an integer a is divisible by another integer b, then b is called the divisor of a. For example: 12 has positive 6 divisors. They are 1, 2, 3, 4, 6 and 12. Let's def…
E. Beautiful Subarrays 题目连接: http://www.codeforces.com/contest/665/problem/E Description One day, ZS the Coder wrote down an array of integers a with elements a1,  a2,  ...,  an. A subarray of the array a is a sequence al,  al  +  1,  ...,  ar for so…
A. Buses Between Cities 题目连接: http://www.codeforces.com/contest/665/problem/A Description Buses run between the cities A and B, the first one is at 05:00 AM and the last one departs not later than at 11:59 PM. A bus from the city A departs every a mi…
B. Shopping 题意:n个顾客,每个顾客要买m个物品,商场总共有k个物品,看hint就只知道pos(x)怎么算了,对于每一个Aij在k个物品中找到Aij的位置.然后加上这个位置对于的数值,然后再将这个Aij放在物品首端去. 思路:直接暴力 PS:开始写二分找写残了.半小时都在调,说实话我也够傻,想想也知道这题暴力肯定可以过,还硬要去调试二分 #include<cmath> #include<cstring> #include<iostream> #include…
链接:http://codeforces.com/contest/665/problem/E 题意:求规模为1e6数组中,连续子串xor值大于等于k值的子串数: 思路:xor为和模2的性质,所以先预处理之后,可以枚举这种确实子串区间的方法为O(n^2): 优化?把每一个前缀xor扔到二叉树中,从根节点出发,以高位前缀值的二进制数构造一颗二叉树,这样就可以在构造的时候,实现对子树节点个数的求解:之后在线求解到当前节点的可选的前缀xor的个数, 即以k为主线 如果当前位k为1,则在前缀二叉树中只能找…
D. Simple Subset 题目连接: http://www.codeforces.com/contest/665/problem/D Description A tuple of positive integers {x1, x2, ..., xk} is called simple if for all pairs of positive integers (i,  j) (1  ≤ i  <  j ≤ k), xi  +  xj is a prime. You are given a…
C. Simple Strings 题目连接: http://www.codeforces.com/contest/665/problem/C Description zscoder loves simple strings! A string t is called simple if every pair of adjacent characters are distinct. For example ab, aba, zscoder are simple whereas aa, add a…
先转换成异或前缀和,变成询问两个数异或≥k的方案数. 分治然后Trie树即可. #include<cstdio> #include<algorithm> #define N 1000010 #define mid (l+r>>1) #define ll long long using namespace std; int n,k,a[N];ll ans; struct Trie { ][],tot,sum[N*]; void init() { ;i<=tot;i+…
发生了好多事情 再加上昨晚教育场的爆零 ..真的烦 题目链接 A题经典题 这个题我一开始推公式wa 其实一看到数据范围 就算遍历也OK 存在的问题进制错误 .. 思路不清晰 两个线段有交叉 并不是端点落在另一个线段 包含的情况落在线段外 a车不影响 结果直接给忽略 #include <iostream> #include<cstdio> using namespace std; int main() { int a,ta,b,tb,hh,mm; cin>>a>&g…