06 2014 档案

GNU的__builtin_popcount函数
摘要:用来计算32位的unsigned int中的1的个数, 其内部实现是根据查表法来计算的。 阅读全文

posted @ 2014-06-26 18:31 Stomach_ache 阅读(256) 评论(0) 推荐(0) 编辑

Codeforces 436C
摘要:题目链接C. Dungeons and Candiestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputDuring the loading of... 阅读全文

posted @ 2014-06-24 18:39 Stomach_ache 阅读(198) 评论(0) 推荐(0) 编辑

Codeforces 442B
摘要:题目链接B. Andrey and Problemtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAndrey needs one more p... 阅读全文

posted @ 2014-06-24 13:31 Stomach_ache 阅读(320) 评论(0) 推荐(0) 编辑

Codeforces 442C
摘要:题目链接C. Artem and Arraytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputArtem has an array of n po... 阅读全文

posted @ 2014-06-24 13:29 Stomach_ache 阅读(311) 评论(0) 推荐(0) 编辑

Codeforces 442A
摘要:题目链接A. Borya and Hanabitime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputHave you ever played Hana... 阅读全文

posted @ 2014-06-21 11:19 Stomach_ache 阅读(328) 评论(0) 推荐(0) 编辑

hackerrank--- challenges/fp-update-list
摘要:纯属为了练习haskell, 竟然贴代码都没办法高亮。challenges/fp-update-listUpdate the values of a list with their absolute values. The input and output portions will be hand... 阅读全文

posted @ 2014-06-18 16:53 Stomach_ache 阅读(310) 评论(0) 推荐(0) 编辑

LeetCode --- Convert Sorted Array to Binary Search Tree
摘要:题目链接Problem discription:Given an array where elements are sorted in ascending order, convert it to a height balanced BST.Accepted Code: 1 /** 2 * Def... 阅读全文

posted @ 2014-06-14 17:54 Stomach_ache 阅读(134) 评论(0) 推荐(0) 编辑

github遇到 non-fast-forward错误
摘要:可以参考:这里解决过程如图所示 阅读全文

posted @ 2014-06-14 14:42 Stomach_ache 阅读(151) 评论(0) 推荐(0) 编辑

sqlserver 带返回值的存储过程
摘要:1 create proc test 2 @result nvarchar(25) output 3 as 4 begin 5 select @result = 'haha' 6 return 1; 7 end 8 go 9 10 declare @result varc... 阅读全文

posted @ 2014-06-12 21:48 Stomach_ache 阅读(580) 评论(0) 推荐(0) 编辑

LeetCode --- Valid Parentheses
摘要:题目链接Problem discriptionGiven a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets mus... 阅读全文

posted @ 2014-06-12 11:35 Stomach_ache 阅读(86) 评论(0) 推荐(0) 编辑

LeetCode ---- Merge Sorted Array
摘要:题目链接Problem discriptionGiven two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size t... 阅读全文

posted @ 2014-06-12 10:31 Stomach_ache 阅读(142) 评论(0) 推荐(0) 编辑

Hdu 1007 最近点对
摘要:题目链接Quoit DesignTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 29547Accepted Submission(s): 7741... 阅读全文

posted @ 2014-06-10 23:23 Stomach_ache 阅读(148) 评论(0) 推荐(0) 编辑

LeetCode --- Populating Next Right Pointers in Each Node II
摘要:题目链接Problem description:Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any binary tree? Would you... 阅读全文

posted @ 2014-06-10 14:55 Stomach_ache 阅读(149) 评论(0) 推荐(0) 编辑

LeetCode --- Populating Next Right Pointers in Each Node
摘要:题目链接Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next po... 阅读全文

posted @ 2014-06-10 14:11 Stomach_ache 阅读(111) 评论(0) 推荐(0) 编辑

LeetCode --- Remove Element
摘要:题目链接题意:给出长度为n的数组,和整数elem, 要求删除数组中存在的elem,返回最终的数组长度。附上代码: 1 class Solution { 2 public: 3 int removeElement(int A[], int n, int elem) { 4 //... 阅读全文

posted @ 2014-06-08 21:05 Stomach_ache 阅读(154) 评论(0) 推荐(0) 编辑

LeetCode --- Pow(x, n)
摘要:题目链接题意:实现pos(x, n)功能, 其中x为double类型,n为int类型附上代码: 1 class Solution { 2 public: 3 double pow(double x, int n) { 4 // handle several particula... 阅读全文

posted @ 2014-06-08 20:39 Stomach_ache 阅读(148) 评论(0) 推荐(0) 编辑

LeetCode --- Rotate Image
摘要:题目链接题意: 给出 n * n的矩阵,要求将矩阵顺时针旋转90°(不使用额外空间) 1 /* 2 Basically, divide the array into 4 along the diagonals, 3 then for each element in the top ... 阅读全文

posted @ 2014-06-08 17:23 Stomach_ache 阅读(154) 评论(0) 推荐(0) 编辑

LeetCode --- Balanced Binary Tree
摘要:题目链接题意: 给定一棵二叉树, 判断是否为平衡二叉树, 这里的平衡二叉树指的是:每个结点的左右子树的深度之差不超过1。附上代码: 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * ... 阅读全文

posted @ 2014-06-08 14:01 Stomach_ache 阅读(150) 评论(0) 推荐(0) 编辑

LeetCode --- Minimum Depth of Binary Tree
摘要:题目链接求二叉树最小深度,最小深度指的是:从根节点走到最近的叶子结点的最短长度附上代码: 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6... 阅读全文

posted @ 2014-06-08 12:31 Stomach_ache 阅读(126) 评论(0) 推荐(0) 编辑

LeetCode --- Validate Binary Search Tree
摘要:题目链接判断一颗二叉树是否是二叉搜索树(二叉排序树),也就是BST如果该二叉树是BST, 那么对其中序遍历,所得序列一定是单调递增的(不考虑有重复数值的情况)附上代码: 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 *... 阅读全文

posted @ 2014-06-05 12:19 Stomach_ache 阅读(97) 评论(0) 推荐(0) 编辑

Codeforces 439C
摘要:题目链接比赛时间没能通过==, 只能说明自己代码写的太不严谨咯!解题思想就是贪心先判断无解的情况: 1. 奇数不够,因为偶数是无法凑成奇数的 2. 偶数不够,2个奇数可以凑成一个偶数 3. 在奇数够用的情况下, 先在k-p堆中每一堆都放一个奇数, 那么剩余的奇数个数一定是个偶数,否则必定会... 阅读全文

posted @ 2014-06-05 10:29 Stomach_ache 阅读(255) 评论(0) 推荐(0) 编辑

LeetCode --- Roman to Integer
摘要:题目链接将罗马数字转换为十进制整数。数据范围为:1~3999罗马数字由7种字母组成,按照特定规则可以组成任意正整数, 需要注意的是罗马数字中没有”0“.关于罗马数字具体可以看:这里附上代码: 1 class Solution { 2 public: 3 int romanToInt(stri... 阅读全文

posted @ 2014-06-04 15:48 Stomach_ache 阅读(108) 评论(0) 推荐(0) 编辑

LeetCode --- Maximum Depth of Binary Tree
摘要:题目链接求树的最大深度附上代码: 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 ... 阅读全文

posted @ 2014-06-04 15:19 Stomach_ache 阅读(123) 评论(0) 推荐(0) 编辑

LeetCode --- Minimum Path Sum
摘要:题目链接简单倒推附上代码: 1 class Solution { 2 public: 3 int minPathSum(vector > &grid) { 4 int n = (int)grid.size(); 5 if (n == 0) return 0; ... 阅读全文

posted @ 2014-06-04 14:38 Stomach_ache 阅读(142) 评论(0) 推荐(0) 编辑

Hashkell 第一篇
摘要:心情极差。。。。。。。。。。。。。。。。。。无事可做,其实是没心情去做事情,只好又翻起了haskell入门记下几点,以备查询:1. 函数名首字符是不可以大写的, 而且名称中可以有单引号,这也是合法的2. if语句中else部分是不可以省略的3. 函数声明无先后顺序4. 数字5既可以是整形也可... 阅读全文

posted @ 2014-06-03 08:39 Stomach_ache 阅读(773) 评论(0) 推荐(0) 编辑

LeetCode --- Partition List
摘要:题目链接又是一个考察对链表基本操作的题目附上代码: 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * Lis... 阅读全文

posted @ 2014-06-02 11:08 Stomach_ache 阅读(158) 评论(1) 推荐(0) 编辑

< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8

导航

统计

点击右上角即可分享
微信分享提示