自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

  • 博客(34)
  • 收藏
  • 关注

原创 判断一个数是质数的几种方法

质数也叫素数,是只能被1和它本身整除的正整数,最小的质数是2,目前发现的最大的质数是p=2^57885161-1【注1】。 判断一个数是质数的最简单的方法如下: [code="Python"] def isPrime1(n): for i in range(2, n): if n % i == 0: return False return True [/code] ...

2013-05-17 16:28:42 568

原创 POJ1276

[code="c++"] #include using namespace std; int main() { int cash,n,max; while(cin>>cash>>n) { max = 0; int m[1001],v[1001]; for(int i = 0;i>m[i]>>v[i]; bool dp[100001]; me...

2013-05-16 12:10:21 115

原创 Project Euler 23:Find the sum of all the positive integers which cannot be writt

A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means th...

2013-05-16 12:08:13 199

原创 ZOJ1046

[code="java"] #include #include //248K 16MS using namespace std; typedef struct RGB { short R; short G; short B; }; int D(RGB a,RGB b) { int t1 = (a.R - b.R) * (a.R - b.R); int ...

2012-12-14 10:02:46 98

原创 POJ2533

[code="java"] #include using namespace std; int main() { int dp[10001]={0},n,a[10001]={0}; while(cin>>n) { for(int i = 1;i>a[i]; dp[1] = 1; int max,tmp; for(int i = 2;i=1;j--) ...

2012-12-13 00:01:38 84

原创 POJ3176

[code="c++"] #include #define N 350 using namespace std; int main() { int n,max; int t[N+1][N+1]={0},dp[N+2][N+2]={0}; cin>>n; for(int i = 1;it[i][j]; max = t[1][1]; for(int i = 1;ima...

2012-12-12 12:06:00 99

原创 POJ1080

[code="c++"] #include #include using namespace std; int value['T'+1]['T'+1]; int dp[101][101]; int max(int a,int b,int c) { int k = (a>b)?a:b; return (c>k)?c:k; } int main(){ value['A...

2012-12-12 11:11:57 84

原创 POJ1028

[code="c++"] #include #include using namespace std; int main() { string websites[102]; websites[1] = "http://www.acm.org/"; string str,tmp; int i = 1,max; while(cin>>str && (str[0] !=...

2012-12-12 09:30:21 104

原创 POJ1006

[code="c++"] #include using namespace std; int main() { int p,e,i,d,num = 1; cin>>p>>e>>i>>d; while((p!=-1) || (e!=-1) || (i!=-1) || (d!=-1)){ while((p!=e) || (p!=i)){ if(p

2012-12-11 12:00:54 74

原创 在vMware7.0中安装apache2

使用apt-get install apache2后,修改配置文件: 1. 默认的配置在/etc/apache2/sites-available/default文件中 2.默认的http.conf是空的,如果要修改ServiceName,在hrttp.conf中添加一句即可 3.端口信息在ports.conf中,如果要修改端口,则要修改其中的内容 4.主机名设置成127.0.0.1:端...

2012-12-01 20:55:23 149

原创 【转】2011阿里云计算研发中心笔试题(45minutes)

2011阿里云计算研发中心笔试题(45minutes) [quote][url]http://oneweaklight.itpub.net/post/42951/519364[/url][/quote] 应聘职位:软件开发工程师-数据平台 1.状态转换图,有限自动机,正则表达式 2.最小堆,删除堆根节点,画出任意结果 3.Heap与stack在进程中的区别 4....

2012-07-24 09:54:23 145

原创 微软面试100题_9

题目:输入一个整数数组,判断该数组是不是某二元查找树的后序遍历的结果。 如果是返回true,否则返回false。 例如输入5、7、6、9、11、10、8,由于这一整数序列是如下树的后序遍历结果: 8 / \ 6 10 / \ / \ 5 7 9 11 因此返回true。 如果输...

2012-05-21 17:24:01 79

原创 名企面试100题_16

输入一颗二元树,从上往下按层打印树的每个结点,同一层中按照从左往右的顺序打印。 [code="java"] public static void hierarchyTraverse(BinaryTree tree){ Queue queue = new Queue(); if(tree.getRoot() != null){ queue.enQueue(tree.g...

2012-05-21 11:42:21 76

原创 名企面试100题_15

第15题(树): 题目:输入一颗二元查找树,将该树转换为它的镜像, 即在转换后的二元查找树中,左子树的结点都大于右子树的结点。 用递归和循环两种方法完成树的镜像转换。 [code="java"] package cn.emma.interview_15; public class Mirror { public static void getMirror(...

2012-05-17 16:46:31 79

原创 名企面试100题_14

第14题(数组): 题目:输入一个已经按升序排序过的数组和一个数字, 在数组中查找两个数,使得它们的和正好是输入的那个数字。 要求时间复杂度是O(n)。如果有多对数字的和等于输入的数字,输出任意一对即可。 例如输入数组1、2、4、7、11、15和数字15。由于4+11=15,因此输出4和11。 [b]思路:[/b] [code="java"] package cn...

2012-05-17 16:42:19 72

原创 面试100题-95

95.华为面试题 1 判断一字符串是不是对称的,如:abccba [code="java"]package cn.emma.interview_95; import java.util.Scanner; public class Reverse { public static void main(String[] args) { Scanner scanner = n...

2012-05-17 10:49:48 91

原创 微软面试100题

2.设计包含min函数的栈(栈) 定义栈的数据结构,要求添加一个min函数,能够得到栈的最小元素。 要求函数min、push以及pop的时间复杂度都是O(1)。package cn.emma.interview_2; public class Stack { public final static int MAX = 100; private static int to...

2012-05-17 10:39:24 94

原创 排序算法(四)

package sort; public class ShellSort { public static void shellSort(int[] numbers){ int d = numbers.length; do{ d = (d+1)/2; shellPass(numbers, d); }while(d > 1); } ...

2012-05-17 10:08:28 76

原创 排序算法(三)

[code="java"] package sort; public class RadixSort { public static void main(String[] args) { int A[] = {329,457,657,839,436,720,355}; radixSort(A, 3); for (int j : A) { System.out....

2012-05-16 11:01:36 85

原创 排序算法(二)

[code="java"] package sort; import java.util.Random; public class QuickSort { private int[] input; private int partition(int[] input,int p,int r){ int x = input[r]; int i = p -1; ...

2012-05-16 11:00:47 65

原创 排序算法(一)

[code="java"] package sort; public class Sort { public static void bubbleSort(int[] numbers){ for(int i = numbers.length -1 ;i>0;i--){ for(int j = 0;j numbers[j+1]){ swap(numbers, j...

2012-05-16 10:55:24 90

原创 ubuntu中设置环境变量

(以Ubuntu10.04,bash shell为准) 在linux下设定环境变量时,如果只是临时用一下,可以直接在shell下用set或export命令设定环境变量,如果希望此环境变量每次开机或打开 shell时自动设定而无须每次都手动设定,那么需要将export命令写入某个系统文件中,拥有这种功能的文件常见的有如下几个: /etc/environment 或 /etc/profil...

2011-11-12 16:04:58 178

原创 Ubuntu下安装JDK

Ubuntu JDK安装配置的详细步骤: Ubuntu JDK安装配置1.下载jdk 下载连接http://java.sun.com/javase/downloads/index.jsp 选择jdk-6u14-linux-i586.bin下载,将jdk-6u14-linux-i586.bin放置于目录/home/liyouliang/develop Ubuntu JDK安装...

2011-11-12 15:56:07 73

原创 Android二三事

今天开始学习Android。尽量记录下学习中所遇到的问题和解决方案。 1、用官网上下载的android installer在windows下安装时,找不到JDK,点击上一步后再点击下一步就好了。...

2011-09-14 00:09:07 56

原创 使用javamail接收邮件

本程序基于Sun公司提供的javamail1.1.4,实现了简单的邮件接收功能,对附件名的的乱码问题进行了处理。 [code="java"] import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.i...

2011-09-08 14:43:13 122

原创 常用邮件服务器地址

常用邮件服务器地址: gmail(google.com)POP3服务器地址:pop.gmail.comSMTP服务器地址:smtp.gmail.com 21cn.com: POP3服务器地址:pop.21cn.comSMTP服务器地址:smtp.21cn.com sina.com: POP3服务器地址:pop3.sina.com.cnSMTP服务器地址:smtp.sina.co...

2011-09-07 23:23:24 480

原创 [转]php5.3(放弃的函数替换)deprecated 错误问题汇总

php 5.3 从一方面来讲,可以说在07年计划PHP6的中的一个pre版本,增加了很多功能,统一了很多语法,使PHP变得更加强大与简洁。 可是我们在升级使用5.3以后会发现以前的旧项目会出现一些问题,统计架构规划,PHP当然会对一些别名,重复功能function进行归类整理,并把一些不用的正式在php 5.3以后删除掉.故不建议在新项目继续使用. PHP 5.3 有两个deprecate...

2011-08-13 15:53:20 149

原创 win7下设置smtp的方法

在win7中开启SMTP服务的方法如下: 1) 首先确定是否开启IIS服务;在运行中输入“inetmgr”,若提示出错,则表明未安装。进入步骤2,否则进入步骤(3); 2) 打开控制面板->程序->打开或关闭windows功能。选择IIS和ASP.NET。 3) 安装完毕后,进入IIS界面,进入自己主机界面,选择SMTP服务器; 4) 进行如下设置:电子邮件地址:syst...

2011-08-13 00:23:46 442

原创 Eclipse编辑器不能打开的解决办法

新建一个workspace,将新的workspace目录下.metadata->plugins->org.eclipse.jdt.core拷贝到元工作目录下相应目录下即可。

2011-08-04 14:18:32 1081

原创 PHP一些知识

1、[color=darkred]类同名函数作为构造函数和_construct()的区别[/color]:在php早期的版本中,使用类同名函数作为构造函数,在php5中使用_construct()作为构造函数,为了实现向后兼容,php5中也支持类同名函数作为构造函数,但是当二者同时存在时,默认_construct()。 2、[color=darkred]PHPBean和数组:[/color]类似...

2011-07-31 10:51:39 125

原创 Axis2服务打包

在Eclipse里安装两个插件,Axis2_Codegen_Wizard_1.3.0和Axis2_Service_Archiver_1.3.0.安装完成后,重启Eclipse。选中要打包的服务所在的工程,右击-》new-》other-》Axis2 Wizards-》Axis2 Service Archiver.之后,wsdl,和xml选自动生成即可。...

2011-07-29 21:22:17 127

原创 ZOJ1004 Anagrams by Stack

Time Limit: 1 Second Memory Limit: 32768 KB How can anagrams result from sequences of stack operations? There are two sequences of stack operators which can convert TROT to TORT: [ i i i i...

2011-07-11 13:54:55 171

原创 ZOJ1006 Do the Untwist

Cryptography deals with methods of secret communication that transform a message (the plaintext) into a disguised form (the ciphertext) so that no one seeing the ciphertext will be able to figure out ...

2011-07-11 11:12:13 85

原创 ZOJ1016 ParenCoding

Time Limit: 1 Second Memory Limit: 32768 KB Let S = s1 s2 ... s2n be a well-formed string of parentheses. S can be encoded in two different ways: By an integer sequence P = p1 p2 ... pn whe...

2011-07-11 11:02:14 153

空空如也

空空如也

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

TA关注的人

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