2018 Multi-University Training Contest 2) HDU 6311 Cover HDU 6312 Game HDU 6313 Hack It HDU 6314 Matrix HDU 6315 Naive Operations HDU 6318 Swaps and Inversions…
  Time Limit: 5000MS   Memory Limit: 65536KB   64bit IO Format: %I64d & %I64u Description Give you a sequence of N(N \leq 100, 000) integers : a_{1},...,a_{n}(0 < a_{i} \leq 1000, 000, 000). There are Q (Q \leq 100, 000) queries. For each query l,…
Redraw Beautiful Drawings Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Problem Description Alice and Bob are playing together. Alice is crazy about art and she has visited many museums around the world. She has…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4897 Problem Description There is an old country and the king fell in love with a devil. The devil always asks the king to do some crazy things. Although the king used to be wise and beloved by his peopl…
题意:构造出n个数 这n个数取值范围0-L,这n个数中存在取一些数之和等于k,则这样称为一种方法.给定n,k,L,求方案数. 思路:装压 每位 第1为表示这种方案能不能构成1(1表示能0表示不能)  第2为表示能不能构成2 ...  这样用d[1<<n] 的DP  像背包那样背 n次就可以 最后状态中第k位为1的就可以加上方法数. #include<cstring> #include<cstdio> #include<cmath> #include <…
//题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6322 //题目大意:给定 k,求第 k 小的数 n,满足 φ(n) 是合数.显然 φ(1) = 1 不是合数,只考虑 n ≥ 2 的情况.//思路:得到题意之后,查到了一张表(https://en.wikipedia.org/wiki/Euler%27s_totient_function)//得知当且仅当 n = 1, 2, 3, 4, 6 时,φ(n) 不是合数.第1小的K值是5,第二小的K值…
bryce1010模板 http://acm.hdu.edu.cn/showproblem.php?pid=6315 /*hdu 1007 首先我们在建立线段树之前应该思考的是线段树的节点维护一个什么值, 在比赛过程中,我想到了维护a[i]的值但是时间复杂度太高,又想到维护a[i]/b[i]但是取下整, 这样的话无法更新∑的值. 在题解中,维护了b[i]的值,因为a[i]最初是0,所以在update过程中当a[i]>=b[i]时,a[i]/b[i]才>=1: 才会对sum有贡献,所以不妨维护b…
bryce1010模板 http://acm.hdu.edu.cn/showproblem.php?pid=6314 ----. 又是一个数学题! 这个题使用容斥原理解决的,现场看dls推公式. 我也推了一遍: f[n][m]=sum { r=0...n,c=0....m } =C(n,r)*C(m,c)*(-1)^(c+r)*2^((n-r)*(m-c)) 列举至少a行b列的情况 f[n][m]=sum{u=a...n,x=b...m}*sum{v=0...n-u,y=0...m-x} =C(…
bryce1010模板 http://acm.hdu.edu.cn/showproblem.php?pid=6313 参考dls的讲解: 以5*5的矩阵为例: 后一列分别对前一列+0+1+2+3+4操作: +0:10000 10000 10000 10000 10000 +1:10000 01000 00100 00010 00001 +2:10000 00100 00001 01000 00010 +3:10000 00010 10000 00100 00001 +4:10000 00001…
bryce1010模板 http://acm.hdu.edu.cn/showproblem.php?pid=6311 从dls思路中,我整理一下自己的思路: 1.首先也是建图 2.建图结束后,一个dfs查找联通块和度数为奇数的点 从第二对奇数度点开始给奇数度点对开始加辅助边(>2*m+1) 3. 加辅助边后,一个dfs搜索所有的奇数度顶点,如果碰到一个虚边,则res+2: 最后一笔画的个数为max(res/2,1) /*hdu6311cover 题意:给出一张无向图,问多少次一笔画能覆盖整张图.…