上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 30 下一页
摘要: 暴力就行了,找出素因子,正的最多是30,然后负的最多是31(这一点wa了一次) #include <cstdio> #include <iostream> #include <ctime> #include <vector> #include <cmath> #include <map> #incl 阅读全文
posted @ 2016-04-13 10:39 shuguangzw 阅读(203) 评论(0) 推荐(0) 编辑
摘要: 题意:求所有小于等于n的,x,y&&lcm(x,y)==n的个数 分析:因为n是最小公倍数,所以x,y都是n的因子,而且满足这样的因子必须保证互质,由于n=1e14,所以最多大概在2^13个因子 即8000多因子 所以每次可以递归暴力寻找一个因子,然后选好了以后,看唯一分解不同种素数还有哪种没有用, 阅读全文
posted @ 2016-04-12 22:33 shuguangzw 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 分析:一段区间的整数除法得到的结果肯定是相等的,然后找就行了,每次是循环一段区间,暴力 #include <cstdio> #include <iostream> #include <ctime> #include <vector> #include <cmath> #include <map> # 阅读全文
posted @ 2016-04-12 21:55 shuguangzw 阅读(102) 评论(0) 推荐(0) 编辑
摘要: 不想说了 #include <cstdio> #include <iostream> #include <ctime> #include <vector> #include <cmath> #include <map> #include <queue> #include <algorithm> #i 阅读全文
posted @ 2016-04-12 21:13 shuguangzw 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 题意:给个矩形的面积a,和矩形的最小边长b,问有多少种矩形的方案(不能是正方形) 分析:a可以写成x,y,因为不能是正方形,所以设x<y,那么x<sqrt(a),y>sqrt(a) 所以找到所有小于sqrt(a)的因子,看有几个大于等于b的就是方案数 因子可以由数的唯一分解定理,求得 具体 : 先筛 阅读全文
posted @ 2016-04-12 13:05 shuguangzw 阅读(220) 评论(2) 推荐(0) 编辑
摘要: 网上一堆题解,我写的是N^2优化的那种,nlogn,O(n)的那种能看懂,但是让我自己在赛场写,肯定没戏了 #include <cstdio> #include <iostream> #include <ctime> #include <vector> #include <cmath> #inclu 阅读全文
posted @ 2016-04-11 14:06 shuguangzw 阅读(228) 评论(0) 推荐(0) 编辑
摘要: 分析:对于每个数,找到欧拉函数值大于它的,且标号最小的,预处理欧拉函数,然后按值建线段树就可以了 #include <iostream> #include <stdio.h> #include <string.h> #include <algorithm> #include <cmath> #inc 阅读全文
posted @ 2016-04-10 11:18 shuguangzw 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 给定整数N,求1<=x,y<=N且Gcd(x,y)为素数的数对(x,y)有多少对. 如果两个数的x,y最大公约数是z,那么x/z,y/z一定是互质的 然后找到所有的素数,然后用欧拉函数求一下前缀和就行 #include <iostream> #include <stdio.h> #include < 阅读全文
posted @ 2016-04-08 22:28 shuguangzw 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 分析:这个题,离线的话就是水题,如果强制在线,其实和离线一个思路,然后硬上主席树就行了 离线的代码 #include <iostream> #include <stdio.h> #include <string.h> #include <algorithm> using namespace std; 阅读全文
posted @ 2016-04-07 14:24 shuguangzw 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 分析:树上第k小,然后我想说的是主席树并不局限于线性表 详细分析请看http://www.cnblogs.com/rausen/p/4006116.html,讲的很好, 然后因为这个熟悉了主席树,真是神器,强制在线,然后顺便学习了LCA倍增算法 LCA倍增算法是O(nlogn)预处理,然后O(log 阅读全文
posted @ 2016-04-06 15:51 shuguangzw 阅读(162) 评论(0) 推荐(0) 编辑
上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 30 下一页