Chinaunix首页 | 论坛 | 博客
  • 博客访问: 97119
  • 博文数量: 21
  • 博客积分: 145
  • 博客等级: 入伍新兵
  • 技术积分: 250
  • 用 户 组: 普通用户
  • 注册时间: 2012-12-22 17:37
文章分类

全部博文(21)

文章存档

2013年(16)

2012年(5)

我的朋友

发布时间:2013-04-12 00:06:22

链接:http://leetcode.com/onlinejudgePalindrome PartitioningGiven a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For example, given s = "aab",Return [ ["aa","b.........【阅读全文】

阅读(1055) | 评论(0) | 转发(0)

发布时间:2013-04-10 21:12:14

链接:http://leetcode.com/onlinejudgeAdd Two NumbersYou are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.Input: (2 -> 4 -.........【阅读全文】

阅读(4048) | 评论(0) | 转发(0)

发布时间:2013-04-08 23:14:11

尝试总结一下const关键词在C++中的用法,不一定全面和正确,希望大家拍砖,共同进步。1、替换#define用const可以在编译阶段进行type检查,避免不必要的错误点击(此处)折叠或打开const int size = 100; //编译器可能会把size放在symbol table里面,而不分配变量内存int arra.........【阅读全文】

阅读(383) | 评论(0) | 转发(0)

发布时间:2013-04-03 22:18:10

原题:http://poj.org/problem?id=1159思路:这个问题其实等价于 求原来字符串 和 反向字符串最小编辑距离。只是操作只有 删除、插入和copy。删除: cost = 1插入: cost = 1copy: cost = 0cost[i][j] = min {cost[i-1][j] + 1, cost[i][j-1] + 1}           &.........【阅读全文】

阅读(560) | 评论(0) | 转发(0)

发布时间:2013-04-03 21:03:53

原题:http://poj.org/problem?id=1015思路:|D-P|尽可能的小,而D+P尽可能的大。显然|D-P|是没有最优子结构的,但是 0<=D,P<=20,而 1<=M<=20,所以可以枚举|D-P|的值,-400<=D-P<=400,所以可以用数组 state[M+1][801]记录所以的情况。每来一个候选人,更新所有的记录和路径,D+P根据题目要求是有最优结构的。.........【阅读全文】

阅读(956) | 评论(0) | 转发(0)
给主人留下些什么吧!~~
留言热议
请登录后留言。

登录 注册