自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

  • 博客(167)
  • 资源 (2)
  • 收藏
  • 关注

原创 【递归调用解题】 概率问题

题目: 概率问题某个袋子中有红球m个,白球n个。现在要从中取出x个球。那么红球数目多于白球的概率是多少呢?下面的代码解决了这个问题。其中的y表示红球至少出现的次数。这与前文的问题是等价的。因为如果取30个球,要求红球数大于白球数,则等价于至少取出16个红球。请根据仅存的线索,判断程序逻辑,并补全缺少的代码。   m:袋中红球的数目   n:袋中白球的数目  

2015-02-22 15:29:45 746

原创 免费简单的在线QQ聊天

今天在写电商网站的时候,用JSP&AJAX写聊天功能写的够蛋疼的。突然想到,有谁会在你这个网站上不知道对方上线有空回你没有整天挂着这个网站呢?比起在网站上聊天,倒不如直接在QQ上聊天。所以目标就是实现点击一个链接直接在QQ上于另外一个人链接。当然前提是已经打开了QQ,还没打开会提示打开。本来以为还要去调用TX的API什么的估计很麻烦。结果只是一个超链

2015-02-15 15:03:51 2213

原创 Jsp邮件找回密码全攻略

@ author  Joy-zhuang一般大型网站我们登录的时候,密码忘了都有个功能可以找回密码。细数下大致的方法:1.直接把密码发送到你的邮箱去。一般是临时密码。2.短信验证,成本较高。3.密保问题4.发送一个链接到你邮箱点击即可更改密码。个人认为第四种方法最经济实惠,这次也主要都是在搞这个。搞了一

2015-02-07 15:18:24 1370

原创 Problem Q 蜜蜂找房子

Problem Q 蜜蜂找房子 时间限制: 1000MS   内存限制: 65536KB   Total Submit: 317  Accepted: 113  Special Judge: No问题描述有一只经过训练的蜜蜂只能爬向右侧相邻的蜂房,不能反向爬行。请编程计算蜜蜂从蜂房a爬到蜂房b的可能路线数。其中,蜂房的结构如下所示:输

2015-02-01 10:23:11 820

原创 用NaN初始化

JAVA中的NaN(Not-a-Number)可以用来初始化一个表接受任何未填充的元素。用0初始化经常会有问题。因为有时候0 也是一个有效值。java.lang.Double和 Java.lang.Float均存在NaN代码:import java.lang.Double;class Main{ public static void

2014-12-15 17:13:23 657

原创 微机接口中的汇编语言

之前汇编学的不是很好。乘这次微机接口把汇编语言算是补上来了。  下面是这段时间的相对于微机接口中使用的汇编语言的笔记。PTR在没有寄存器名存在的情况下,用操作符“X ptr”指明内存单元的长度,X在汇编指令中可以为word 或者byte。例如:mov word ptr ds:[0],1inc word ptr

2014-12-07 12:36:55 844

原创 通往蓝桥杯之路

距离蓝桥杯四个月,四个月的练习,加油!

2014-11-24 21:21:32 107

原创 leetcode Valid Palindrome

Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."race a car" is not a pa

2014-11-24 00:52:10 430

原创 MAC xampp 启动失败

原文地址: http://meiyitianabc.blog.163.com/blog/static/1050221272013116232752/问题:80端口被暂用,导致服务器无法启动解决1、先关闭mac自带的web服务。2、用下面的命令强制杀死所有 httpd 进程,sudo killall httpd多运行几次,出现如下

2014-11-20 18:27:26 1282

原创 Mac下Myeclipse中console Tomcat乱码问题

解决方案: window -> Preference -> myeclipse -> servers -> tomcat -> tomcat7.0 -> JDK -> optional java VM arguments :加入 -Dfile.encoding=GBK

2014-11-20 18:24:43 889

原创 Mac OS X Spotlight 优化指南

新买的mbp突然间用不了spotlight了,看到了这篇文章用里面的关掉spolight再重开spotlight解决。原帖链接: Mac OS X Lion Spotlight 优化指南http://bbs.feng.com/read-htm-tid-4008789.htmlSpotlight是一个让我又爱又恨的东西,一方面他确实相当好用

2014-11-17 16:39:20 2028

原创 leetcode Min Stack

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get

2014-11-16 11:27:15 425

原创 LeetCode Min Stack

Min Stack Total Accepted: 4445 Total Submissions: 28706My SubmissionsQuestion Solution Design a stack that supports push, pop, top, and retrieving the minimum element in constant

2014-11-15 23:41:48 105

原创 mac os 常用命令

参考原文:http://www.startos.com/mac/tips/201011048450.html  http://www.macx.cn/thread-2075903-1-1.html很多朋友对osx下的命令行操作挠头,估计多数是在windows时代开始接触计算机的。有dos基础的应该是看看就明白,而玩过Linux的应该是轻车熟路了。这个贴子希望能给见到

2014-11-14 22:21:24 290

原创 Mac Os下安装Myeclipse提示insufficient memory

如图所示:搞了两天终于解决来。发现网上对此问题的解决办法也是说的不清不楚对,总的来说有三种方法,当然我只用了其中都一种。方法一:Mac OS中用虚拟内存来提高性能,可是我用的macbook 有8g内存 要用上虚拟内存还是比较少的,所以你可以开几个大程序把你的内存耗光,然后再重新安装就可以来。方法二:贴吧看到的,解决办法为I

2014-11-14 17:45:51 3898 1

原创 Mac OS X搭建Tomcat服务运行环境

参考原文:http://neville.liu.blog.163.com/blog/static/49938781201273114311885/本教程将教你如何在苹果雪豹系统下建立JSP服务器运行环境。第一步:下载 Apache Tomcat要做jsp开发,需要有一个编译JSP文件的服务器,相当于windows平台下的IIS。Apache Tomcat是不

2014-11-13 22:37:31 620

原创 MySQL 浮点型表示

MySQL浮点型和定点型可以用类型名称后加(M,D)来表示,M表示该值的总共长度,D表示小数点后面的长度,M和D又称为精度和标度,如float(7,4)的可显示为-999.9999,MySQL保存值时进行四舍五入,如果插入999.00009,则结果为999.0001。FLOAT和DOUBLE在不指定精度时,默认会按照实际的精度来显示,而DECIMAL在不指定精度时,默认整数为10,小数为0。创

2014-11-07 09:32:01 925

转载 MYSQL TABLE TYPE

不像MyISAM 存储引擎,每个表只是一个文件.(这样在某些系统下最大2G限制). 而Innodb没有此限制,可以无限扩展.Mysql4.0 的以后版本都支持innodb 存储.MySQL有几种表格类型可供选择,每一种类型都有一些各具优缺点的功能。这些类型分别是ISAM、MyISAM、HEAP、MERGE、BDB和InnoDB。选择类型时要依据许多因素。这些因素包括性能、事务、列锁定和

2014-11-07 00:10:01 338

原创 面对技术海洋,如何选择一个属于自己的技术方向?

最近很纠结一个问题:是要暂且放下越写越喜欢的JAVA去学习IOS还是不学IOS只是专注于JAVA.JAVA学了一年多了,也越学越上手了,可是买了MACBOOK不学IOS还真有点不舍得。几天无意间看到了这个帖子终于发下了自己的问题的答案:面对技术海洋,如何选择一个属于自己的技术方向?相信很多工作一两年的人都有一个困惑,自己写了不长时间的代码做了一些东西但是都不精通,面对各种层

2014-11-05 21:47:29 720

原创 Windows下 JSP链接MYSQL(JDBC) MYECLIPSE

首先下载JDBC驱动:传送门在MYSQL中创建数据库create database books;建立表以及插入数据等:use books;create table book(bookId varchar(50),bookName varchar(50),publishervarchar(100),price float,con

2014-11-04 00:04:57 709

原创 动态规划 - 钢条切割问题

已知钢条切割的不同长度对应的不同价格如下所示:长度i      1    2    3    4    5    6    7    8    9    10价格pi    1   5    8   9    10   17   17   20    24   30求输入长度,输出最佳的收益。详细理论知识见《算

2014-10-31 23:55:16 322

原创 Java 大数类的使用

头文件:java.math.*;Ⅰ基本函数:1.valueOf(parament); 将参数转换为制定的类型  比如 int a=3;  BigInteger b=BigInteger.valueOf(a);  则b=3;  String s=”12345”;  BigInteger c=BigInteger.valueOf(s);  则c=12345;

2014-10-31 23:05:44 224

原创 LeetCode Longest Palindromic Substring

Given a string S, find the longest palindromic substring in S. You may assume that the maximum length ofS is 1000, and there exists one unique longest palindromic substring.输入一个字符串,返回最大回文串

2014-10-30 23:34:47 568

原创 最长不重复子串

算法参考:http://sxnuwhui.blog.163.com/blog/static/1370683732012513103935198/找到一个字符串中的一个连续子串,这个子串内不能有任何两个字符是相同的,并且这个子串是符合要求的最长的。例如输入"abcbef",输出"cbef"。O(N)的算法,具体思路如下:以abcbef这个串为例,用一个数组pos记录每个元素曾

2014-10-30 11:26:47 213

原创 Leet Code 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. For

2014-10-30 11:11:47 509

原创 Leetcode Same Tree

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.一直不太懂递归的写法

2014-10-29 22:02:38 503

原创 LeetCode Climbing Stairs

You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?每一次你可以爬一层或者两层,计算爬n层你

2014-10-29 21:46:25 510

原创 LeetCode Merge Sorted Array

Given 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 that is greater or equal to m +n) to hold additional elements from B

2014-10-29 12:17:29 502

原创 LeetCode Remove Duplicates from Sorted List

Given a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3.输入排序过的链表,删除相同的元素。

2014-10-29 12:11:54 441

原创 LeetCode Plus One

Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at the head of the list.题目描述:输入一个数组表示的

2014-10-28 12:52:36 636

原创 Leet Code Add Binary

Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".实现二进制数相加,算法很简单就是两个String每位去相加,然后判断是否要进位。一开始想到了一个不同的算法,即将两个String转为int型然后相加

2014-10-28 12:21:26 667

原创 LeetCode Merge Two Sorted Lists

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.题目描述:类似以前C语言做的输入两个链表,按照顺序大小将其连接。不过这次试着用JAVA做,

2014-10-27 17:08:32 501

原创 LeetCode Length of Last Word

Given a string s consists of upper/lower-case alphabets and empty space characters' ', return the length of last word in the string.If the last word does not exist, return 0.Note: A word is defi

2014-10-27 12:56:08 589

原创 LeetCode Implement strStr()

Implement strStr().Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack.输入两个字符串,如果第二个是第一个的字串返回该串在第一个字符串开始的的子串。比如abcd bc 则返回bcd

2014-10-26 22:16:42 358

原创 LeetCode Remove Element

Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't matter what you leave beyond the new length.题

2014-10-26 20:43:38 358

原创 LeetCode Remove Duplicates from Sorted Array

Given a sorted array, remove the duplicates in place such that each element appear onlyonce and return the new length.Do not allocate extra space for another array, you must do this in place with

2014-10-26 20:26:37 343

原创 LeetCode Remove Nth Node From End of List

Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the l

2014-10-26 20:08:30 338

原创 LeetCode Valid Parentheses

Given a string containing just the characters '(', ')', '{', '}', '[' and']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are all val

2014-10-26 16:23:14 473

原创 [Java]Stack类

Java Stack类顾名思义,实现堆栈。具体方法如下: import java.util.Stack; public class StackTest { public static void main(String[] args) { Stack stack = new

2014-10-26 16:21:35 252

原创 LeetCode Longest Common Prefix

Write a function to find the longest common prefix string amongst an array of strings.这道题目就真的是比较水了,题目意思就是要我们找出最大的公共子序列。通过两个循环就可以解决了!详见代码:public class Solution { public String longestCo

2014-10-25 21:42:11 365

基于Java Swing&Mysql的图书管理系统

参考书籍用Java Swing 和 Mysql编写的图书管理系统。 功能多,分类明确,代码编写风格也很好。附上MYSQL的数据库文件,导入即可以用!

2015-01-14

基于JAVA的词法分析器

可以实现 注释、符号表打印、十六进制等等的词法分析器。

2014-12-07

空空如也

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

TA关注的人

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