• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
Hug_Sea
博客园    首页    新随笔    联系   管理    订阅  订阅
上一页 1 2 3 4 5 6 7 8 ··· 13 下一页
2012年8月3日
POJ-3126 Prime Path
摘要: 题意:给出两个四位素数a、b,问从a到b最少变几次(每次变1位并且只能为素数)。思路:bfs。题目链接:http://poj.org/problem?id=3126View Code 1 #include <cstdio> 2 #include <cmath> 3 #include <cstdlib> 4 #include <cstring> 5 #include <string> 6 #include <queue> 7 #include <algorithm> 8 #include <iostream 阅读全文
posted @ 2012-08-03 19:42 Hug_Sea 阅读(165) 评论(0) 推荐(0)
POJ-2689 Prime Distance
摘要: 题意:给定两个数L、U,求L到U范围内相邻两个素数之差最小和最大的两对素数。思路:因为1<=L< U<=2,147,483,647,而U-L<=1,000,000,所以要对L到U范围内进行素数筛选,然后找出即可。题目链接:http://poj.org/problem?id=2689View Code 1 #include <cstdio> 2 #include <cmath> 3 #include <cstdlib> 4 #include <cstring> 5 #include <string> 6 #inc 阅读全文
posted @ 2012-08-03 10:48 Hug_Sea 阅读(139) 评论(0) 推荐(0)
2012年8月2日
POJ-2909 Goldbach's Conjecture
摘要: 题意:给定一个偶数n,求将其分解成两个素数的种数。思路:水水。。。题目链接:http://poj.org/problem?id=2909View Code 1 #include <cstdio> 2 #include <cmath> 3 #include <cstdlib> 4 #include <cstring> 5 #include <string> 6 #include <algorithm> 7 #include <iostream> 8 using namespace std; 9 const int 阅读全文
posted @ 2012-08-02 19:10 Hug_Sea 阅读(98) 评论(0) 推荐(0)
POJ-2262 Goldbach's Conjecture
摘要: 题意:给定一个偶数n,将其分解成两个素数(有多组则输出差值最大的)。思路:水水.......题目链接:http://poj.org/problem?id=2262View Code 1 #include <cstdio> 2 #include <cmath> 3 #include <cstdlib> 4 #include <cstring> 5 #include <string> 6 #include <algorithm> 7 #include <iostream> 8 using namespace std 阅读全文
posted @ 2012-08-02 18:56 Hug_Sea 阅读(101) 评论(0) 推荐(0)
POJ-2191 Mersenne Composite Numbers
摘要: 题意:给定k,求所有满足小于2^k的所有梅森数(2^p(p为素数)-1被素因子分解的数)。思路:此题一看就想到打表、先暴力打表,然后直接写即可。题目链接:http://poj.org/problem?id=2191View Code 1 /**********************************暴力打表***************************** 2 #include <cstdio> 3 #include <cmath> 4 #include <cstdlib> 5 #include <cstring> 6 #incl 阅读全文
posted @ 2012-08-02 16:09 Hug_Sea 阅读(333) 评论(0) 推荐(0)
POJ-3641 Pseudoprime numbers
摘要: 题意:对于一个非素数p和任意一个数a,若a^p=a(mod p),则输出yes,否则输出no。思路:判断素数+二分幂。题目链接:http://poj.org/problem?id=3641View Code 1 #include <cstdio> 2 #include <cmath> 3 #include <cstdlib> 4 #include <cstring> 5 #include <string> 6 #include <algorithm> 7 #include <iostream> 8 using 阅读全文
posted @ 2012-08-02 11:24 Hug_Sea 阅读(124) 评论(0) 推荐(0)
2012年8月1日
FOJ-1607 Greedy division
摘要: 题意:给定一个n,将n平均分成m份,问有几种方法,每种方法中找出最大的数。思路:就是求n的因子数、先将每个数求出最小素因子、再将n的所有素因子数加1相乘。小结论:求一个数的所有因子数、先分解、n=(a^x)*(b^y)*(c^z),(a、b、c均为素数),因子数=(x+1)*(y+1)*(z+1)。题目链接:http://acm.fzu.edu.cn/problem.php?pid=1607View Code 1 #include <cstdio> 2 #include <cmath> 3 #include <cstdlib> 4 #include < 阅读全文
posted @ 2012-08-01 09:20 Hug_Sea 阅读(144) 评论(0) 推荐(0)
2012年7月31日
【转】生命中的最后一天
摘要: 前些日子惊闻dsh的噩耗,是在网友的BLOG上看到的。当时我就笑了,怎么可能呢,愚人节还没过完么。不过仔细想想貌似有个把月没联系了, CALL之,但电话那头已经关机了。这时我就笑不出来了。后来从他同学那里得到消息,确实是几个月前查出肝癌晚期,几天前走了。还是不敢相信,精力如此旺盛的人,居然说走就走了。天妒奇才,尚未扬名立万而先逝,甚至连一篇讣告都没有。 dsh生长于单亲家庭,母亲做项目,经常应酬,也许是这样塑造了他喜欢宁静、独处的性格。不得不承认,他是一个天才,真正的天才。初中就在理科方面显出了过人的天份。升入高中后,由于不喜欢教条的科目,他几乎没上过课。直到高考时他才有... 阅读全文
posted @ 2012-07-31 10:13 Hug_Sea 阅读(235) 评论(0) 推荐(1)
2012年6月20日
HDU-1010 Tempter of the Bone
摘要: 题意:给出N*M的地图,问能否从S到D话费T时间。思路:dfs奇偶剪枝。题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1010View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include <cmath> 5 #include <string> 6 #include <algorithm> 7 #include <iostream> 8 using namespa 阅读全文
posted @ 2012-06-20 19:55 Hug_Sea 阅读(161) 评论(0) 推荐(0)
2012年6月19日
HDU-2660 Accepted Necklace
摘要: 题意:有n个石头,包含重量和价值,从中挑选最多k个石头做成一条项链,要求重量不大于W,求最大价值。思路:dfs.题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2660View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include <cmath> 5 #include <string> 6 #include <algorithm> 7 #include <iostream 阅读全文
posted @ 2012-06-19 20:32 Hug_Sea 阅读(135) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 ··· 13 下一页
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3