- 博客(7)
- 收藏
- 关注
原创 划分和相等的子集-LintCode-动态规划经典问题/背包问题
给一只含有正整数的非空数组, 判断这个数组是否可以划分为 两个元素和相等的子集。注意事项:所有数组元素不超过100.数组大小不超过200.样例:给一数组 [1, 5, 11, 5] , 返回 true , 两个子集:[1, 5, 5], [11]给一数组 [1, 2, 3, 9] , 返回 false思路:动态规划,对于数组nums,判断奇偶性,若为奇数,肯定不...
2019-03-24 15:10:39
953
原创 满二叉树和完全二叉树
区别:满二叉树就是节点都满了,完全二叉树就是每个节点都和满二叉树一一对应。(这个定义太牛逼了,刚才想半天没有想出来)也就是说,完全二叉树可能出现满二叉树,也可能没有装满,有一个左子树,没有右子树,但是一定不会出现,有右子树没有左子树的情况。...
2019-03-13 00:21:30
305
原创 栈的使用
#include#includeusing namespace std;int main(){stacks;couts.push(1);s.push(2);s.push(3);s.push(4);s.push(5);//压进去五个元素 cout//此时栈不为空,值为0 cout couts.pop(); //将栈
2016-12-17 23:25:41
309
原创 putchar()与getchar()
putchar函数的作用:向终端输出一个字符。(1)putchar函数只能用于单个字符的输出,且一次只能输出一个字符。#includeusing namespace std;int main(){char ch;ch = getchar();//getchar()是用来读入键盘输入的字符 putchar(ch);//putchar()是输
2016-12-17 21:55:38
623
原创 1006. Team Rankings
DescriptionIt's preseason and the local newspaper wants to publish a preseason ranking of the teams in the local amateur basketball league. The teams are the Ants, the Buckets, the Cats, the Dribb
2016-12-16 20:44:45
495
原创 1021. Couples
ConstraintsTime Limit: 1 secs, Memory Limit: 32 MB DescriptionN couples are standing in a circle, numbered consecutively clockwise from 1 to 2N. Husband and wife do not always stand together.
2016-12-14 20:34:34
369
原创 1194 . Message Flood
Well, how do you feel about mobile phone? Your answer would probably be something like that “It’s so convenient and benefits people a lot”. However, if you ask Merlin this question on the New Year’s E
2016-12-07 18:10:12
482
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人