原题网址:https://open.kattis.com/problems/classrooms Classrooms The new semester is about to begin, and finding classrooms for orientation activities is always a headache. There are k classrooms on campus and n proposed activities that need to be assigne…
原题网址:https://open.kattis.com/problems/boxes Boxes There are N boxes, indexed by a number from 1 to N.Each box may (or not may not) be put into other boxes. These boxes together form a tree structure (or a forest structure, to be precise). You have to…
原题地址:https://open.kattis.com/problems/aplusb FFT代码参考kuangbin的博客:http://www.cnblogs.com/kuangbin/archive/2013/07/24/3210565.html A+B Problem Given N integers in the range [−50000,50000], how many ways are there to pick three integers ai, aj, ak, such…
原题网址:https://open.kattis.com/problems/driver Crazy Driver In the Linear City, there are N gates arranged in a straight line. The gates are labelled from 1 to N. Between adjacent gates, there is a bidirectional road. Each road takes one hour to travel…
时间限制:5000ms 单点时限:5000ms 内存限制:256MB 描述 Profess X is an expert in signal processing. He has a device which can send a particular 1 second signal repeatedly. The signal is A0 ... An-1 under n Hz sampling. One day, the device fell on the ground accidenta…
原题地址:http://acm.hdu.edu.cn/showproblem.php?pid=5881 Tea Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 451    Accepted Submission(s): 124 Problem Description Tea is good. Tea is life. Tea is e…
原题地址:http://acm.hdu.edu.cn/showproblem.php?pid=5901 题意:输入n,输出n以内质数个数 模板题,模板我看不懂,只是存代码用. 官方题解链接:https://async.icpc-camp.org/d/560-2016 /************************************************************ 这个模板我一点都不会,代码是从codeforces上抄的,佚名 pi(i)表示i以内质数的个数 ******…
题目 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3856 先预处理求出两个素数的和与积,然后枚举n-prime和n/prime的情况. 表达式可能的情况 a a*b a+b a+b+c a*b*c a*b+c  (注意没有(a+b)*c的情况) 对于a*b和a+b的判重 只需要控制 a<=b的范围即可 对于a*b+c的情况 不存在重复情况 对于a+b+c a*b*c 分三种情况 ①a!=b && b!=c…
题目描述 给定\(n\)个数$a_i$,起初第\(i\)个数在第\(i\)个集合.有三种操作(共\(m\)次): 1 $u$ $v$ 将第$u$个数和第$v$个数所在集合合并 2 $u$ 将第$u$个数所在集合所有数加1 3 $u$ $k$ $x$ 问$u$所在集合有多少个数模$2^k$余$x$. 数据范围:\(n,m \le 500000,a_i \le 10^9, 0 \le k \le 30\). 简要题解 显然此题可以用set加启发式合并在\(O(n \log ^2 n)\)时间复杂度解…
ACM-ICPC 南昌网络赛F题 Megumi With String 题目描述 给一个长度为\(l\)的字符串\(S\),和关于\(x\)的\(k\)次多项式\(G[x]\).当一个字符串\(str\)是S的子串时,定义\(str\)的\(value\)值为\(G[length(str)]\),否则\(value=0\).一个字符串的\(power\)值定义为其所有子串的\(value\)之和.每次向\(S\)末尾添加一个字符,重复\(m\)次.求每次添加字符后,一个长度为\(n\)的随机串\…