码迷,mamicode.com
首页 >  
搜索关键字:palindrome partition    ( 4210个结果
leetcode - Partition List
题目:Partition ListGiven a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should p...
分类:其他好文   时间:2014-08-26 13:08:16    阅读次数:401
LeetCode: Valid Palindrome
LeetCode: Valid PalindromeGiven a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example,"A...
分类:其他好文   时间:2014-08-25 22:31:25    阅读次数:216
Goffi and Squary Partition
题意:给你N和K,问能否将N拆分成K个互不相同的正整数,并且其中K-1个数的和为完全平方数.PS:这道题目原来是要求输出一种可行方案的,所以下面题解是按照输出方案的思想搞的。分析:我们尝试枚举那个完全平方数S,然后看能否将他拆分为 K-1 个数,并且不用到N-S这一步可以用贪心+一次调整来搞定。为了...
分类:其他好文   时间:2014-08-25 22:31:14    阅读次数:328
双向快速排序
#include using namespace std;void swap(int* p,int* q){ int temp = *p; *p = *q; *q = temp;}//快速排序int partition(int *ptr,int first, int last){ ...
分类:其他好文   时间:2014-08-25 21:07:04    阅读次数:268
HDU 4982 Goffi and Squary Partition(BestCoder Round #6 1002)
贪心+数学调整,这里需要比较好的数学想法。当然自己通过推导选出各种情况也是可以的,不过可能稍微麻烦些!不过,这道题目不失为一道好题!...
分类:其他好文   时间:2014-08-25 17:03:54    阅读次数:120
HDOJ 4982 Goffi and Squary Partition
Goffi and Squary Partition Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 374    Accepted Submission(s): 145 Problem Description R...
分类:其他好文   时间:2014-08-25 15:05:34    阅读次数:176
[BestCoder Round #6] hdu 4982 Goffi and Squary Partition(构造)
Goffi and Squary Partition Problem Description Recently, Goffi is interested in squary partition of integers.A set X of k distinct positive integers is called squary partition of n if and ...
分类:其他好文   时间:2014-08-25 11:52:45    阅读次数:208
hdu4982 Goffi and Squary Partition (DFS解法)
BestCoder Round #6Bhttp://acm.hdu.edu.cn/showproblem.php?pid=4982Goffi and Squary PartitionTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/...
分类:其他好文   时间:2014-08-25 11:34:44    阅读次数:236
19. Palindrome Partitioning && Palindrome Partitioning II (回文分割)
思想: 简单的深度优先搜索。 思想: 动态规划: n = s.length(); Record[i] = 0 , ( i = n || is...
分类:其他好文   时间:2014-08-25 02:17:23    阅读次数:187
HDU 4982 Goffi and Squary Partition(推理)
HDU 4982 Goffi and Squary Partition 思路:直接从完全平方数往下找,然后判断能否构造出该完全平方数,如果可以就是yes,如果都不行就是no,注意构造时候的判断,由于枚举一个完全平方数,剩下数字为kk,构造的时候要保证数字不重复 代码: #include #include #include int n, k; bool judge(int...
分类:其他好文   时间:2014-08-24 23:54:13    阅读次数:283
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!