题目链接:http://www.lightoj.com/volume_showproblem.php?problem=1232
题意:每个物品价值为val[i] (>=1),每个物品有k种,组成价值为k的方案数。完全背包。
解法:完全背包计数。
代码:#include
#include
#include
#include <limits.h...
分类:
其他好文 时间:
2015-06-16 13:09:40
阅读次数:
131
输入一个二叉树,输出其镜像。
如下图,即交换所有节点的左右子树。
这里提供两种思路:使用递归和不使用递归。
使用的二叉树定义如下:
public class TreeNode {
int val = 0;
TreeNode left = null;
TreeNode right = null;
public Tr...
分类:
其他好文 时间:
2015-06-16 00:00:56
阅读次数:
811
1、css3选择器 属性选择器。[attr=val],attr表示属性,val表示值。例如:[id=sec]{background:red}. [att*=val]选择器。其中*表示包含,意思是包含val。 [att^=val]选择器。其中^表示开头,意思是开头为val。 [att$=val...
分类:
Web程序 时间:
2015-06-15 20:28:39
阅读次数:
140
//新增等级 验证用户输入数据的合法性
function insert(obj) {
var flag = addValidation(obj);
if(flag){
var sorts = $(obj).parent().siblings().find("input[name='sorts']").val();//用于验证排序...
分类:
Web程序 时间:
2015-06-15 16:24:54
阅读次数:
184
1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) : val(x), ne...
分类:
其他好文 时间:
2015-06-15 14:24:51
阅读次数:
122
二位数组做法;
#include
#include
#define M 1009
typedef struct pack
{
int cost;
int val;
}PACK;
int f[M][M];#include
#include
#define M 1009
typedef struct pack
{
int cost;
int val;
}PACK;
i...
分类:
其他好文 时间:
2015-06-15 09:30:14
阅读次数:
117
关于Mysql group_concat的应用 ■事先准备: CREATE TABLE TBL_GRP_CAT ( ID INT, VAL CHAR ); INSERT INTO TBL_GRP_CAT VALUES(1, ‘a‘); INSERT INTO TBL_GRP_CAT VALUES(1, ‘b‘); INSERT INTO TBL_GRP_CAT VAL...
分类:
数据库 时间:
2015-06-14 17:03:20
阅读次数:
157
样例
给出中序遍历:[1,2,3]和前序遍历:[2,1,3].
返回如下的树:
2
/ 1
/**
* Definition of TreeNode:
* class TreeNode {
* public:
* int val;
* TreeNode *left, *right;
* TreeNode(int val) {
* ...
分类:
其他好文 时间:
2015-06-14 16:41:30
阅读次数:
123
sql example 9 – group, havingsql example 9 – group, havinggroupsql createsql deletesql selecttruncate table user1;insert into user1 (id, username) val...
分类:
数据库 时间:
2015-06-14 16:28:57
阅读次数:
138
题目意思:对两个递增链表进行归并排序思路:没什么好说的,二路归并 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ...
分类:
编程语言 时间:
2015-06-14 12:08:08
阅读次数:
132