• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
Hug_Sea
博客园    首页    新随笔    联系   管理    订阅  订阅
2012年10月11日
POJ-2773 Happy 2006(容斥版)
摘要: 题意:给出,m和k,求第k个与m互质的数。m (1 <= m <= 1000000), K (1 <= K <= 100000000).思路:容斥+二分,很巧妙的方法。题目链接:http://poj.org/problem?id=2773View Code 1 #include <iostream> 2 #include <cstdio> 3 #include <cstdlib> 4 #include <cmath> 5 #include <cstring> 6 #include <string> 阅读全文
posted @ 2012-10-11 19:20 Hug_Sea 阅读(197) 评论(0) 推荐(0)
HDU-2841 Visible Trees
摘要: 题意:就是给定一个坐标(n,m),求(1,1)到(n,m)区间内x与y互质的坐标数。思路:利用容斥从2到n,遍历与m互质的个数。题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2841View Code 1 #include <iostream> 2 #include <cstdio> 3 #include <cmath> 4 #include <cstdlib> 5 #include <cstring> 6 #include <string> 7 #include <a 阅读全文
posted @ 2012-10-11 10:56 Hug_Sea 阅读(203) 评论(0) 推荐(0)
POJ-3904 Sky Code
摘要: 题意:给出n个数,问找出4个数满足4个数最大公约数为1,最多有多少组。思路:容斥原理,遍历每个数的素因子,奇数个加偶数个减,然后C(n,4)-sum。题目链接:http://poj.org/problem?id=3904View Code 1 #include <iostream> 2 #include <cstdio> 3 #include <cmath> 4 #include <cstdlib> 5 #include <cstring> 6 #include <string> 7 using namespace std 阅读全文
posted @ 2012-10-11 10:41 Hug_Sea 阅读(219) 评论(0) 推荐(0)
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3