自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

静水流深

桃李不言,下自成蹊。

  • 博客(81)
  • 资源 (1)
  • 收藏
  • 关注

原创 zoj 1002 Fire Net

#include using namespace std;int visit[10][10], count, ret, N;bool isLocate(int x, int y) { for(int j = y; j >= 1; j--) { if( visit[x][j] == 1 ) return 0; if(visit[x][j] == 2) break;

2016-02-23 09:28:56 525

原创 zoj 1003 Crashing Balloon

因式分解题目,用递归来解决。代码如下:// 因式分解相关#include #include #include using namespace std;bool aTrue, bTrue;void dfs(int m, int n, int p) { // m >= n if(aTrue) return; // forget if(m == 1 && n == 1

2016-02-23 09:24:46 553

原创 Hibernate 与 JPA 小记

Hibernate 核心包括三个部分:Hibernate-core、Hibernate-annotation(包含jpa-annotation)、Hibernate-entityManager(适配Hibernate Core 和 JPA)Hibernate实现了JPA的标准,可以单独使用配置文件或者注解,来连接数据库。但,比较通用的做法是 JPA + Hibernate集成,

2016-01-07 15:41:17 512

原创 [bug] Field 'id' doesn't have a default value

在使用 spring + Hibernate + JPA 连接 Mysql时,报错如下:bug:Field 'id' doesn't have a default value原因是因为自己粗心,主键id并没有自增,没有勾选:AUTO_INCREMENT  代码:public static void main(String[] args) { ApplicationCon

2016-01-06 16:46:31 1256

原创 关于编程素养

个人记录一下,想到的几点编程的基本素养:1. 参数检查非常重要,在每个单独的函数中,开始都应该进行参数检查。    如果参数为空,则抛异常至上一级,或者根据需求赋默认值。2. 每个函数体,记得放入try catch 块中,异常如果无法处理则抛出。    如果catch住异常的话,最起码要输出错误信息,方便调试。3. 尽量避免中文注释。4. 开发过程中,要尽量考虑提供给使用者

2016-01-06 15:18:27 781

原创 一年以来的成长

刚刚简单的写完了一年的总结,但是在技术这个地方并没有更多的提及。刚才简单的整理了一下2015年一年以来,在印象笔记中剪辑的和自己写的内容,发现很多的知识自己虽然已经记录下来了,但是依旧很陌生,或者基本忘记了。而且,满满的笔记,大多都是剪辑,很少有自己的思考和技术总结,这都是很不好的习惯。从研一,到现在。共一年半的时间。项目上横向来说,做的事情从 web开发入门(struts,Hiber

2016-01-03 10:55:39 769

原创 蛇形填数

在n*n的方阵里填入 1, 2, …… n*n, 要求填成蛇形,例如 n=4 时,方阵为:10 11  12 1 9   16  13 28   15  14 37    6    5  4上面的方阵中,空格只是为了便于观察规律,不必严格输出。n分析:掌握要领:下 -> 下 -> 下 -> 左 -> 左 -> 左 -> 上 -> 上 -> 上 -> 右 -> 右

2015-10-17 07:34:49 519

原创 jersey client返回list

bug:Exception in thread "main"javax.ws.rs.WebApplicationException:javax.xml.bind.UnmarshalException - with linked exception:[com.sun.istack.SAXParseException2; lineNumber: 1; columnNumbe

2015-09-28 18:30:11 2270

原创 21 - Merge Two Sorted Lists - LeetCode

Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.分析:就是归并排序的merge过程,只不过用链表实现了。可以递归进行,也可以迭代。自己的代码又臭又

2015-09-16 06:58:33 420

原创 100 - SameTree

Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value./** * Def

2015-09-15 05:56:25 546

原创 258 - Add Digits

Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has on

2015-09-15 05:41:14 485

原创 169- Majority Element

Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element

2015-09-13 14:26:08 349

原创 分治法 - 归并排序

归并排序是分治法的典型应用,思想如下:divide:divide the array to 2 subarrayconquer:reverse in 2 subarray,if only one elem ,returncombine:merge two ordered subarrayT(n) =  2 T(n / 2) + O (n)O(n)指的是combine所消

2015-09-13 10:45:12 584

原创 为 vector 重载 << (输出操作符)

代码如下:#include #include using namespace std;ostream& operator& _vec);int main() { vector vec(10, "n"); cout << vec << endl;}ostream& operator& _vec) { vector::const_i

2015-09-06 10:50:07 5217

原创 为自定义的类写<<(输出)操作符

#include using namespace std;class item;ostream & operator <<(ostream & os, item& _item);class item {public: friend ostream& operator<< (ostream& os, item& _item); int i;

2015-09-06 10:42:30 1047

原创 8 - String to Integer (atoi)

Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input ca

2015-08-31 12:00:37 910

原创 3 - Longest Substring Without Repeating Characters

Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. Fo

2015-08-12 09:06:14 403

原创 2 - Add Two Numbers

You 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 link

2015-08-12 07:10:26 380

原创 1- Two Sum

Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the target, whe

2015-08-11 20:55:57 426

原创 中国将帅象棋问题

#include #define HALF_BITS_LENGTH 4#define FULLMASK 255 // 1111 1111#define LMASK (FULLMASK << HALF_BITS_LENGTH) // 1111 0000#define RMASK (FULLMASK >> HALF_BITS_LENGTH) //0000 1111// 低四位置

2015-08-11 09:59:44 555

原创 231 - power of two

Given an integer, write a function to determine if it is a power of two.Credits:Special thanks to @jianchao.li.fighter for adding this problem and creating all test cases.bool isPowerOfTwo(i

2015-08-11 08:27:26 434

原创 232 - Implement Queue using Stacks

Implement the following operations of a queue using stacks.push(x) -- Push element x to the back of queue.pop() -- Removes the element from in front of queue.peek() -- Get the front element.empty(

2015-08-08 11:34:16 495

原创 233 - Number of Digit One

Number of Digit One Total Accepted: 307 Total Submissions: 1853Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n.

2015-08-07 18:03:22 2273

原创 234 - Palindrome Linked List

Given a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space?没有达到上述的 O(1) space。C++ 代码如下:Connecting to proxy server(10.109.247.19

2015-08-07 08:35:52 527

原创 152 - Maximum Product Subarray 错误记录

Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,4],the contiguous subarray [2,3] has the largest

2015-08-06 09:16:41 373

原创 238 - Product of Array Except Self

Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].Solve it without division and in O

2015-08-06 08:14:58 423

原创 241-Different Ways to Add Parentheses

Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid operators are+, - and *.Example 1I

2015-08-05 07:20:51 1976

原创 242-Valid Anagram

Given two strings s and t, write a function to determine if t is an anagram of s.For example,s = "anagram", t = "nagaram", return true.s = "rat", t = "car", return false.Note:You may a

2015-08-04 08:05:13 1218

原创 thrift -java

book.thriftnamespace java example struct Book_Info { 1: i32 book_id, 2: string book_name, 3: string book_author, 4: double book_price, 5: string book_publisher, }test.thriftnamespa

2015-07-28 17:53:33 831

原创 Vim 常用快捷键

移动光标:hjkl : 左下上右 —— 移动光标: w filename 写入新文件删除:x 删除光标位置的字符dd 删除光标所在的行dw(delete word) 删除光标所在位置的单词d$  删除光标至行尾的内容J   删除光标所在行尾的回车追加数据等:u(undo) 撤销前一条编辑命令a(add)在当前光标后追加数据A 在当前光

2015-07-17 06:49:22 564

原创 C++ 类初探

感悟:C++:无非是C 的语法特性 与 C++的类语法相结合,支持面向对象和面向过程的混合。当然,C++的 STL 库,以及包括容器等内容,是扩充的,需要慢慢来熟悉。代码:#include#includeusing namespace std;struct ListNode { int val; struct ListNode *

2015-07-17 06:44:50 498

原创 237 - Delete Node in a Linked List

题目:Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node

2015-07-17 05:52:38 476

原创 203 - Remove Linked List Elements

题目:Remove all elements from a linked list of integers that have value val.ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 --> 3 --> 4 --> 5Credits:Speci

2015-07-17 05:49:01 537

原创 x86 汇编程序基础

最简单的汇编程序:这个程序只做了一件事情:退出,退出状态是 4链接(linking):就是将不同部分的代码和数据收集和组合成为一个单一文件的过程,这个文件可被加载(或拷贝)到存储器并执行。链接可以执行于编译(compile time)时,也就是在源代码被翻译成机器代码时;也可以执行于加载(load)时,也就是在程序被加载器(loader)加载到存储器并执行时。甚

2015-07-15 08:33:23 1157

原创 2-11章 笔记

注释不能嵌套,// 形式的不能跨行。 C语言历史:Old Style C、 C89(ANSI C)、 C99(ISO/IEC9899:1999)main函数的特殊之处,在于执行程序时它自动被操作系统带哦用,操作系统就认准了main这个名字,除了名字特殊以外,main函数和别的函数没有区别。C89 要求所有的声明写在所有语句之前,而C99的新特性允许语句和声明按任意顺序排列,只要标识符都遵循先声

2015-07-08 08:05:20 365

原创 第5章 使用Linux环境变量

bash shell 用一个称作环境变量的特性存储有关shell会话和工作环境的信息。 这也是他们为什么被称作环境变量的原因,它允许你在内存中存储数据,以便在运行在shell上的程序和脚本访问。这也是存储永久数据的一种简便方法,这些数据可以使用来识别用户账户、系统、shell的特性以及任何其他你需要存储的数据。p101全局环境变量和局部环境变量。 全局:哪都可见,在进入bash之前就已经存在了。

2015-07-07 20:33:49 397

原创 第4章 更多的 bash shell命令 - df、du、sort、grep、zip、tar等

Linux 系统将所有的磁盘都挂载到一个虚拟目录下。 在使用新的存储媒体之前,你需要把他们放到虚拟目录下。这项工作成为挂载(mounting)。在Linux系统上移除一个可移动设备时,不能直接从系统上删除,而应该先卸载它。df:有时,你需要知道某个设备还有多少磁盘空间,df命令就是轻松查看所有进程已挂载磁盘的使用情况的。 df有一些命令行参数可用,但是基本上你不会用到。一个常用的参数是 -h ,

2015-07-07 20:31:54 884

原创 什么是程序?

编程语言分为低级语言和高级语言; 机器语言和汇编语言属于低级语言,直接用计算机指令编写程序。而 C、C++、Java、Python等属于高级语言,用语句编写程序,语句是计算机指令的抽象表示。c 语言 : a = b + 1;汇编语言: mov 0x804101c, %eax add $0x1, %eax mov %eax, 0x804a018机器语言: a1 1c a0 04 08 8

2015-07-07 08:51:05 824

原创 <精通正则表达式>学习笔记 第一章

正则表达式由两种字符组成:元字符 和 普通字符(文字)行的开始和结束: 脱字符号 ^ :行的开始 —— ^cat 只寻找行首的cat 美元符号 :行的结束——cat :行的结束—— cat 只寻找行尾的 cat正则表达式结构体:[ ] ,也就是字符组,里面是“或”的意思,应该是只能出现一个!前面的成立,后面的就不继续了。 在字符组内部,- 表示连字符 < H[123456]> 和 < H[

2015-07-05 16:32:29 425

原创 低级IO - read

不需要标准库的 scanf 等函数,而是直接调用 unix 系统低级IO函数 read。 实现:将任意输入复制到任意输出。代码如下:int main() { char buf[5]; int n; while ((n = read(0, buf, 5)) > 0) { write(1, buf, n);

2015-07-05 07:10:34 733

Java RESTful Web Service实战.pdf

书籍的一部分,主要是讲解jersey的,为数不多的一本相关的书籍。

2015-09-20

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除