自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(131)
  • 收藏
  • 关注

最少拦截系统

描述某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统。但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能超过前一发的高度。某天,雷达捕捉到敌国的导弹来袭。由于该系统还在试用阶段,所以只有一套系统,因此有可能不能拦截所有的导弹。怎么办呢?请帮助计算一下最少需要多少套拦截系统?输入输入若干组数据(不超过100组),每组数据一行,分别为:导弹总个数(正整数,...

2009-12-16 15:12:25 210

char * 与 char []

There is an important difference between these definitions: char amessage[] = "now is the time"; /* an array */ char *pmessage = "now is the time"; /* a pointer */amessage is an array, just big e...

2009-12-15 20:46:18 291

Javascript PING

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head>&

2009-12-15 13:26:43 262

POJ 1004

#include <stdio.h>int main(){ float f; float sum = 0; int i = 12; while(i--) { scanf("%f", &f); sum += f; } sum = sum / 12;...

2009-11-19 17:49:56 120

POJ 1005

#include <stdio.h>const float PI = 3.1415926;int main(){ int i, N, A; scanf("%d", &N); float X, Y; for( i = 1; i <= N; i++) { scanf("%f%f",...

2009-11-19 17:48:33 98

POJ 1003

#include <stdio.h>double a[275];int main(){ int i; for( i = 1; i < 275; i++) { a[i] = a[i - 1] + 1/(double)(i+1); } double num; scanf("...

2009-11-18 15:58:07 101

POJ 1491

#include <stdio.h>#include <stdlib.h>#include <math.h>void swap(int &a, int &b){ int c = a; a = b; b = c;}int gcd(int a, int b){ if(a < b) swa...

2009-11-10 15:27:27 158

POJ 1353

#include <stdio.h>#include <string.h>#include <stdlib.h>int main(){ int n, m, k; int i,j; while(scanf("%d,%d,%d", &n, &m, &k) == 3) { char * src ...

2009-11-09 14:57:38 125

POJ1002

#include <iostream>#include <string>using namespace std;int myctoi(const char c);int a[10000000];int main(){ int N; cin>>N; string str; int num; while(N--) { num = 0; cin>>st...

2009-11-06 15:14:38 118

POJ 1218

#include <iostream>using namespace std;int cells[101];int main(){ int N; cin>>N; int n, answer; while(N--) { cin>>n; for(int i = 2; i <= n; i+...

2009-11-05 18:28:00 127

test

  1     .file   "test.c"  2     .section    .rodata  3 .LC0:  4     .string "address of i = %u\n"  5 .LC1:  6     .string "input please"  7 .LC2:  8     .string "%d"  9 .LC3: 10     ...

2009-10-12 23:17:18 115

总结: 提高网站访问速度

Best Practices for Speeding Up Your Web Site原文:http://developer.yahoo.com/performance/rules.html#page-nav 优化网站性能 提高网站速度访问速度的14条实践http://www.phpv.net/html/1660.html  Minimize HTTP Reque...

2009-09-20 17:15:03 115

Divie into Python 读书笔记 第三章

List1.list [] 定义2.List有负索引,list[-k]=lisk[n-k]3.list的切片slice  li[m,n],从m到n(不包括)  3.1 m到n没有区间,返回空的list 3.2 list[:n] 返回从o到n的list 3.3 list[n:] 返回n后面所有的list4  4.1 list.append() 向list添加元素 ...

2009-08-25 22:26:08 157

原创 如何用加1操作实现减法

转载自  http://www.matrix67.com/blog/archives/944/trackback   设想这样一个计算机系统,它只支持以下几个操作:    1. 定义变量、给变量赋值;    2. 变量自身加一;    3. 令一段语句循环执行指定的次数。  这个系统只处理且只能处理0和正整数。系统不存在“溢出”的问题。  注意这个系统没有比较运...

2009-08-17 10:16:22 221

ByteofPython 笔记

用MindMap 做的笔记。

2009-08-14 12:24:22 102

Reservoir Sampling

随即抽样问题:     要求从N个元素中随机的抽取k个元素,其中N无法确定。   是在 《计算机程序设计与艺术》 中看到的这个题目,书中只给出了解法,没给出证明。   解决方法是叫Reservoir Sampling (蓄水池抽样)                         Init: a reservoir with the size: k ...

2009-08-10 16:37:56 197

thickbox跨越frameset

     thickbox跨越iframe的问题很好解决,只需要在父页和iframe页都要载入 jquery.js thickbox.js thickbox.css(别忘记了父页面)修改thickbox.js 函数function tb_init(domChunk) 找到tb_show(t,a,g); 这句修改为:if (window.parent.frames[window....

2009-08-05 16:04:05 121

HRule组件

 HRule组件   所属包: mx.controls   用途:绘制一条水平直线。   属性:CharacteristicDescriptionDefault sizeThe default width is 100 pixels, default height is 2 pixels. By default, the HRule ...

2009-07-30 13:42:06 386

原创 Valgrind 使用简单说明(ZZ)

调不尽的内存泄露,用不完的Valgrind(一个介绍程序调试的精彩讲解:http://www.ibm.com/developerworks/cn/linux/l-pow-debug/)Valgrind 介绍 Valgrind是一个GPL的软件,用于Linux(For x86, amd64 and ppc32)程序的内存调试和代码剖析。你可以在它的环境中运行你的程序来...

2009-07-22 12:20:37 113

Linux Shell “bad interpreter”

魔数很多类型的文件其文件起始的几个字节的内容是固定的(或是有意填充,或是本就如此)。因此这几个字节的内容也被称为魔数 (magic number,还有别的意思),因为根据这几个字节的内容就可以确定文件类型。例如 FreeBSD 上 ELF 文件的magic number 就是文件的前四个字节依次为"7f 45 4c 46",对应的ascii字符串即 "^?ELF"。tar 文件的m...

2009-07-16 19:20:42 150

echo $IFS

学习IFS的时候,我一直想知道 默认的时候 IFS=' \t\n'那么我echo $IFS的时候应该显示' \t\n'才对啊.因为通过 set | grep IFS的时候确实能看到' \t\n'. 后来才知道 IFS中的值 已经不是普通的字符了,而是起隔离作用的特殊字符。例如:$IFS=:$a=hello:world$echo $a这个时候输出的是hello w...

2009-07-16 17:37:58 373

移除文件中的BOM头--in Python

#!/usr/bin/python#Remove BOM head and replace the Windows linefeeds with the Unix linebreak.#The script search the jsp files in the current directory by defalut.#You can specify the directory an...

2009-07-16 13:27:34 110

Linux backtricks "`"

shell中 backtricks  "`"的用法: The backtick allows you to assign the output of a shell command to a variable. 可以把一个shell命令的输出付给一个变量 例如 date=`date`echo The time is $date    user...

2009-07-14 22:58:31 94

原创 深入分析Flex [Bindable] 以及使用方法

深入分析Flex [Bindable] 以及使用方法http://www.gold98.net/blog/article.asp?id=1078 [Bindable]大概又是Flex用得最多的元数据了。刚开始用用确实好简单,效率真是没的说。不过这几天用着却碰到了些问题,我自己搜集了些资料,想着有必要在blog里总结一下吧。啥是元数据(metadata)知道就跳...

2009-07-13 11:56:47 104

mx.states

 文档上这样写的:The State class defines a view state, a particular view of a component. For example, a product thumbnail could have two view states; a base view state with minimal information, and ...

2009-07-13 11:26:09 82

Flex 与Server通信

不管前端展现技术是jsp或者是Flex抑或其他web语言,对于Server而言只会看到通过HTTP协议传送过来的数据(不论是POST还是GET方法);不同的只是jsp和Flex提交请求的方式(语法不同) 和 对服务器返回的数据展现的方式。  下面给出了一个Flex 和 Servlet(struts的Action) 通信的例子。 <?xml version="1.0" en...

2009-07-09 19:41:35 221

原创 Device eth0 has different MAC address than expected

前天在弄VMware的时候,在VMware上clone了一个linux,后来在clone的linux(RedHat Enterprise Linux 4)上不能上网了,激活eth0时老弹出 Device eth0 has different MAC address than expected ,我们只要编辑这个文件:/etc/sysconfig/network-scripts/ifcfg-eth0...

2009-07-03 10:32:20 232

Perforce 支持 Araxis

 1. 安装Araxis Merger 2008.            PRODUCT INFORMATIONYou purchased the following product:Product Purchased: Araxis Merge Professional Product Code: MGP Single-User Serial Number(s):Key[...

2009-07-02 15:34:08 133

原创 getKey

#include <iostream>#include <fstream>#include <afx.h>#include <string>using namespace std;int WCharToChar(UINT PageCode, std::wstring strWChar, std::string &s...

2009-06-30 21:31:23 241

字符串删除问题

 去trend笔试也是这个题目。不过比这个简单。。不过这个题目以前看过了,没仔细看,笔试的时候自己把之给想出来了。  输入两个字符串,从第一字符串中删除第二个字符串中所有的字符。例如,输入”They are students.”和”aeiou”,则删除之后的第一个字符串变成”Thy r stdnts.”  一个字符串中删除。但...

2009-06-28 18:11:28 182

原创 strcpy()、memcpy()、memmove()、memset()的实现

strcpy()、memcpy()、memmove()、memset()的实现  strcpy(), 字符串拷贝.char *strcpy(char *strDest, const char *strSrc){    assert((strDest!=NULL) && (strSrc !=NULL));    char *address = st...

2009-06-18 10:46:10 153

原创 编程之道

                编程之道    ————————————————————————一 太虚幻境二 古贤三 设计四 编码五 维护六 管理七 集体智慧八 硬件软件九 尾声————————————————————————        *  太虚幻境-----------------------------------真正的程序员...

2009-06-08 21:58:33 255

对于给定的整数,求出删除该整数中的一个数字后得到的最小值

对于给定的整数,求出删除该整数中的一个数字后得到的最小值.比如,1214 ,去掉2,得到的结果是114为最小值.  算法: 删除数字中的极大值( 左边的数字递增,右边紧邻的数字是减少的或者本身为最后一位。例如:1214 中的2 ;  122543中的5; 1334中的4) 证明:假设极大值为第i位,记为X[i].分2种情况,1 。如果删除 i 左边的某位记第j位,即删除...

2009-06-06 23:31:04 885

KMP算法:基于自动机的理解

 KMP算法学习总结 KMP算法看似简单,其实想要完全理解还是有困难的。 KMP其实可以搜索过程可以看成是一个自动机,分为2部分,第一部分自动机的构造(对应一般的说法就是失效函数,转移函数,overlap函数),第二部分在自动机上搜索过程。举个例子:目标串味T = acabaabaabcacaabc; ...

2009-06-04 17:10:42 423

原创 读书笔记,(杂)

引用与指针的区别:1. 引用必须被初始化。指针可以不初始化。    int a;      int  & b = a;    int * pi;    引用初始化有种特殊情况。const引用。 const int & a = 0;  const int & b =2.2;2. 用一个指针给另外一个指针赋值,改变的指针;用一个引用给另外个引用赋值,...

2009-06-02 22:45:29 97

KMP算法实现(参考Wiki上算法描述)

#include <iostream>using namespace std;/*** paramter pat:待匹配的字符串* T: 返回的table***/void kmp_table(const char * W, int T[]){ int pos = 2; //当前查找的位置 int cnd = 0; //当前查找的前缀字串的位...

2009-06-02 21:39:30 131

Big_endian and little_endian

试题1:请写一个C函数,若处理器是Big_endian的,则返回0;若是Little_endian的,则返回1Answer:int checkCPU(){ {  union w  {    int a;   char b;  } c;  c.a = 1;  return (c.b == 1); }}定义一个union数据结构,...

2009-05-28 22:22:41 68

原创 strlen与sizeof的区别

strlen与sizeof的区别1.sizeof操作符的结果类型是size_t,它在头文件中typedef为unsigned int类型。该类型保证能容纳实现所建立的最大对象的字节大小。 2.sizeof是算符,strlen是函数。 3.sizeof可以用类型做参数,strlen只能用char*做参数,且必须是以''\0''结尾的。4.数组做sizeof的参数不退化,传递给...

2009-05-26 09:44:27 78

java中与各主流数据库的连接语句

MySQL:        String Driver="com.mysql.jdbc.Driver";    //驱动程序    String URL="jdbc:mysql://localhost:3306/db_name"?useUnicode=true&characterEncoding=UTF-8;    //连接的URL,db_name为数据库名...

2009-05-21 15:17:00 97

原创 正则表达式

http://unibetter.com/deerchao/zhengzhe-biaodashi-jiaocheng-se.htm

2009-05-17 18:51:59 79

空空如也

空空如也

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

TA关注的人

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