ACM
文章平均质量分 86
皮皮蟹01
在校计算机专业本科生一枚,想与大家一起交流技术、代码、前沿科技、new idea。还请社区里的大神们多关照。^_^
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
poj 2418 map的简单使用
Hardwood Species Time Limit: 10000MS Memory Limit: 65536K Total Submissions: 24642 Accepted: 9521 Description Hardwoods are the botanical group of trees that have b原创 2017-04-09 17:03:34 · 487 阅读 · 0 评论 -
Manacher算法:求解最长回文字符串,时间复杂度为O(N)
回文串定义:“回文串”是一个正读和反读都一样的字符串,比如“level”或者“noon”等等就是回文串。回文子串,顾名思义,即字符串中满足回文性质的子串。 经常有一些题目围绕回文子串进行讨论,比如POJ3974最长回文,求最长回文子串的长度。朴素算法是依次以每一个字符为中心向两侧进行扩展,显然这个复杂度是O(N^2)的,关于字符串的题目常用的算法有KMP、后缀数组、AC 自动机,这道转载 2017-05-27 11:07:59 · 344 阅读 · 0 评论 -
poj1979 DFS
Red and Black Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 34961 Accepted: 18920 Description There is a rectangular room, covered with square tiles. E原创 2017-04-20 21:57:59 · 282 阅读 · 0 评论 -
poj1258 最小生成树
Agri-Net Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 56761 Accepted: 23531 Description Farmer John has been elected mayor of his town! One of his cam原创 2017-04-05 11:12:03 · 274 阅读 · 0 评论 -
poj1664 放苹果
放苹果 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 33602 Accepted: 20799 Description 把M个同样的苹果放在N个同样的盘子里,允许有的盘子空着不放,问共有多少种不同的分法?(用K表示)5,1,1和1,5,1 是同一种分法。原创 2017-04-05 10:41:13 · 321 阅读 · 0 评论 -
poj1519 数论简单题
Digital Roots Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 26535 Accepted: 8874 Description The digital root of a positive integer is found by summing原创 2017-04-05 10:03:50 · 558 阅读 · 0 评论 -
poj2002 哈希链地址法
Squares Time Limit: 3500MS Memory Limit: 65536K Total Submissions: 19983 Accepted: 7691 Description A square is a 4-sided polygon whose sides have equal length and ad原创 2017-04-04 21:44:04 · 427 阅读 · 0 评论 -
poj2104 K-th Number
K-th Number Time Limit: 20000MS Memory Limit: 65536K Total Submissions: 55738 Accepted: 19177 Case Time Limit: 2000MS Description You are working for Macrohard原创 2017-04-13 11:00:28 · 251 阅读 · 0 评论 -
杭电ACM 2602 Bone Collector背包
Bone Collector Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 58027 Accepted Submission(s): 24207 Problem Description Many years ag原创 2017-03-14 23:13:28 · 2314 阅读 · 1 评论 -
poj2909 哥德巴赫猜想
哥德巴赫猜想:一个大于4的数一定能由俩个质数之和得来。 现题目要求判断,给出的数能表达成多少组 质数之和 的形式,而且a+b与b+a是同一种情况。 代码写起来还是很简单的,注意枚举的时候枚举到中间即可。 #include #include using namespace std; bool isprime(int x) { int a=sqrt(x+0.5); for(int原创 2017-04-09 17:27:37 · 446 阅读 · 0 评论 -
poj1458 最长公共子序列
#include #include #include #include using namespace std; int max_n[100][100]; char str1[100],str2[100]; int main() { while(scanf("%s%s",str1,str2)!=EOF) { memset(max_n,0,sizeof(max_n))原创 2017-03-27 19:34:55 · 1134 阅读 · 0 评论 -
poj 1504 水题
输入俩个数,将这两个数反转相加后再反转输出。 #include using namespace std; int reversed(int a) { int b=0; while(a) { b=b*10+a%10; a=a/10; } return b; } int main() { int n; int a原创 2017-04-09 16:32:07 · 497 阅读 · 0 评论 -
poj 3176 动态规划
/* dp记录每点的最优解 从下往上计算dp的值所以dp[0][0]为最终最优解,dp[i][j]=max(dp[i+1][j],dp[i+1][j+1]) */ #include #include #include using namespace std; int d[400][400]; int dp[400][400]; int main() { int n; cin>>原创 2017-04-09 16:02:58 · 306 阅读 · 0 评论 -
poj1088 dp
滑雪 Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 96210 Accepted: 36486 Description Michael喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或原创 2017-04-09 15:21:06 · 283 阅读 · 0 评论 -
poj2503 map
Babelfish Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 43115 Accepted: 18242 Description You have just moved from Waterloo to a big city. The people her原创 2017-03-30 17:22:23 · 457 阅读 · 0 评论 -
poj3349 哈希
题目让你判断所给雪花是否存在同构,也就是是否存在数据相同的两组数。纯暴力求解会超时,需要用到哈希。实质就是将一部分哈希,一部分暴力,以此来减少时间复杂度。 该题的键值可以取每一个雪花求和取余的一个数。 注意要用scanf。 代码: #include #include #include #include using namespace std; int s[6]; const int k=1原创 2017-03-30 16:19:33 · 366 阅读 · 0 评论 -
杭电ACM 1069Monkey and Banana
Monkey and Banana Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 13827 Accepted Submission(s): 7274 Problem Description A group of原创 2017-03-13 20:48:54 · 924 阅读 · 0 评论 -
poj2262 简单素数判定
Goldbach's Conjecture Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 45296 Accepted: 17255 Description In 1742, Christian Goldbach, a German amateur mat原创 2017-04-08 16:48:01 · 261 阅读 · 0 评论 -
poj1007 DNA Sorting
题意为给定一组字符串,让你以逆序数的方式将这些字符串排序。在这里我用的是结构体的存储结构来存储的,结构体里有两个数据域,一个用来保存字符串,一个用来保存该字符串的逆序数。将字符串输入后,用sort排序即可,注意排序是以逆序数递增的方式来排的。题目没有难度。 代码: #include #include using namespace std; struct ss { char str[1原创 2017-04-08 16:22:23 · 249 阅读 · 0 评论 -
poj1840 哈希
Eqs Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 16229 Accepted: 7965 Description Consider equations having the following form: a1x13+ a2x23+ a3x33+ a4x4原创 2017-03-27 21:10:13 · 385 阅读 · 0 评论
分享