题意: 有5000组询问,每组询问求有多少i,j满足i∈[1,n],j∈[1,m]且gcd(i,j)的质因子数目<=p. n,m<=500000 思路: 首先预处理出每个数的质因子数目分别等于多少,则问题转化为求给定区间内,gcd等于某一堆数的i,j有多少组 发现很像一个基础莫比乌斯反演题:hdu1695.但是此题在某组询问中可能要处理很多个gcd,所以需要进行一些预处理 我们首先筛出每个数的莫比乌斯函数和它的质因子个数 通过容斥的公式可以看出如果要求的gcd为d,那么d*i的倍数对答案的贡献…
Two Rabbits Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 505    Accepted Submission(s): 260 Problem Description Long long ago, there lived two rabbits Tom and Jerry in the forest. On a sunny…
Mex Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 623    Accepted Submission(s): 209 Problem Description Mex is a function on a set of integers, which is universally used for impartial game t…
Save Labman No.004 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 624    Accepted Submission(s): 154 Problem Description Due to the preeminent research conducted by Dr. Kyouma, human beings hav…
Zhuge Liang's Mines Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 239    Accepted Submission(s): 110 Problem Description In the ancient three kingdom period, Zhuge Liang was the most famous an…
Caocao's Bridges Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 194    Accepted Submission(s): 89 Problem Description Caocao was defeated by Zhuge Liang and Zhou Yu in the battle of Chibi. But…
Save Labman No.004 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 979    Accepted Submission(s): 306 Problem Description Due to the preeminent research conducted by Dr. Kyouma, human beings ha…
The Donkey of Gui Zhou Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 389    Accepted Submission(s): 153 Problem Description There was no donkey in the province of Gui Zhou, China. A trouble m…
就是求最小权值的桥..不过有好几个坑... 1:原图不连通,ans=0. 2: m<=n^2 显然有重边,重边必然不是桥,处理重边直接add(u, v, INF). 3:   最小桥边权为0的时候,ans=1,至少要派一个人运炸弹... #include<iostream> #include<algorithm> #include<vector> #include<string> #include<queue> #include<st…
http://blog.sina.com.cn/s/blog_a401a1ea0101ij9z.html 空间两直线上最近点对. 这个博客上给出了很好的点法式公式了...其实没有那么多的tricky...不知到别人怎么错的... //#pragma comment(linker, "/STACK:1024000000,1024000000") #include<algorithm> #include<iostream> #include<cstring&g…