上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 52 下一页
摘要: 题意:gcd(a,b,c)=g; lcm(a,b,c)=l; 求出符合的a,b,c的所有情况有多少中。思路:l/g=p1^x1*p2^x2*p3^x3.....; x/g=p1^a1*p2^a2*p3^a3.....;b/g=p1^b1*p2^b2*p3^b3.....;c/g=p1^c1*p2^... 阅读全文
posted @ 2014-11-19 19:01 null1019 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 思路:a/b=x; a=b*x; b*x-9973*y=n; 用扩展欧几里得;对于等式ax+by=c,abc皆为整数且c是gcd(a, b)的倍数,且(x1, y1)是方程ax+by=gcd(a, b)一组整数解,则(x1*(c/gcd(a, b)), y1*(c/gcd(a, b)))是方程ax+... 阅读全文
posted @ 2014-11-19 16:50 null1019 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 题意:找出小于n是m个数每个数的倍数的数的个数。思路:用二进制表示是那几个数的倍数。 二进制进行容斥,去掉小于0的数。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 __int64 n,m,g; 7 __int64 a... 阅读全文
posted @ 2014-11-19 10:58 null1019 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 题意:求出在一个区间[A,B]内与N互质的个数 。思路:先求出n的质因子,然后求出与N的质因子不互质的个数然后总个数减去就是。用位运算二进制表示那个因子用到过,实现容斥原理。在1到n之间是c倍数的个数为n/c; 1 #include 2 #include 3 #include 4 #defin... 阅读全文
posted @ 2014-11-18 20:17 null1019 阅读(117) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=5102补题.题意:给你n-1条边,然后没两个节点的距离按照递增的顺序,求出前k项的和。思路:把所有边(u,v) 以及(v,u)放入一个队列,队列每弹出一个元素(u,v),对于所有与u相邻的点w,如果w!=v,就把(... 阅读全文
posted @ 2014-11-10 10:39 null1019 阅读(254) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=5101在比赛的时候没有想出怎么做,自己真水。题意:给定一些集合,选择两个来自不同集合的数,加和大于k,问有多少种选择方案。思路:答案=从所有数中选择的两个加和大于k的数的方案数-在同一个集合中选择的两个加和大于k的... 阅读全文
posted @ 2014-11-08 23:03 null1019 阅读(515) 评论(1) 推荐(1) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=5100在比赛时没看懂题就没看,结束之后,看了解题报告才知道怎么做。解题报告:首先,若n 2 3 int main() 4 { 5 int t,n,k; 6 while(scanf("%d",&t)... 阅读全文
posted @ 2014-11-08 22:07 null1019 阅读(133) 评论(0) 推荐(0) 编辑
摘要: http://codeforces.com/contest/376/problem/B 1 #include 2 #include 3 #include 4 #define maxn 10001 5 using namespace std; 6 7 int n,m; 8 int g[110]... 阅读全文
posted @ 2014-11-08 20:44 null1019 阅读(116) 评论(0) 推荐(0) 编辑
摘要: http://codeforces.com/contest/374/problem/C记忆化搜索,题意:求按照要求可以记过名字多少次,如果次数为无穷大,输出Poor Inna!,如果不经过一次输出Poor Dima!,否则输出输出次数。 1 #include 2 #include 3 #incl... 阅读全文
posted @ 2014-11-08 16:54 null1019 阅读(242) 评论(0) 推荐(0) 编辑
摘要: http://codeforces.com/contest/374/problem/B 1 #include 2 #include 3 #include 4 using namespace std; 5 6 char str[200001]; 7 8 int main() 9 {10 ... 阅读全文
posted @ 2014-11-06 21:53 null1019 阅读(140) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 52 下一页