自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 java之static分析

对于学习static我们先来看两个例子://Example 1  Tst.java,no main() method   package com.blogchina.qb2049;   public class Tst   {      static { System.out.println("111111"); }    }运行结果为: 111111

2013-03-02 21:16:18 303

原创 二分查找求上界 下界

#include#include#includeint a[10]={5,5,2,6,5,8,3,8,5,9};int hig_binSearch(int n,int b,int e){//左闭右开    while(e-b>1){                            //有一个元素        int m = b+(e-b)/2;        i

2012-09-19 13:26:27 902

原创 先根+中根 创建二叉树

#include#includestruct node{    node *left;    node *right;    char ch;    node(){        left = NULL;        right = NULL;        ch = '\0';    }};node *root;node *restruct(

2012-09-18 23:22:10 1306

原创 3752:走迷宫 bfs dfs

//bfs#include#includechar map[41][41];int vis[41][41];int col[4]={0,-1,0,1};int row[4]={-1,0,1,0};void bfs(int c,int r){    int queue[100000];    memset(queue,0,sizeof(queue));

2012-09-16 11:00:32 595

原创 2815:城堡问题 百炼 求连通子图个数

#include#includeint map[60][60];int vis[60][60];int col[4]={0,-1,0,1};int row[4]={-1,0,1,0};//西,北,东,南int val[4]={1,2,4,8};int m,n;int dfs(int p){    int a=p/n,b=p%n;    //printf("%

2012-09-16 09:48:41 1010

原创 java线程互斥实例

/* * To change this template, choose Tools | Templates * and open the template in the editor. */package syndemo;class MyThread implements Runnable{private int target=10;        //不加synch

2012-05-29 12:54:50 506

转载 操作系统中断

1、中断的类型。从中断事件的性质出发,中断可以分为两大类:强迫性中断事件:包括硬件故障中断,程序性中断,外部中断和输入输出中断等。自愿性中断事件:是由正在运行的进程执行一条访管指令用以请求系统调用而引起的中断,这种中断也称为"访管中断"。一般情况下,优先级的高低顺序依次为:硬件故障中断、自愿中断、程序性中断,外部中断和输入输出中断。自愿中断的断点是确定的,而强迫性中断的断点可能发生

2012-05-27 23:06:32 4098

原创 回溯法 百炼2749:分解因数

2749:分解因数ViewSubmitStatisticsClarifyTime Limit: 1000ms Memory Limit: 65536kBDescription给出一个正整数a,要求分解成若干个正整数的乘积,即a = a1 * a2 * a3 * ... * an,并且1 Input第1行是测试数

2012-05-07 13:16:20 2771

转载 宏定义使用

#include #define MAX 5//#undef MAXint main (){    #ifdef MAX    printf("%d\n",MAX);    #endif    printf("~~~~~");    return 0;}输出为:5~~~~~#include #define MAX 5#undef

2012-05-04 23:30:01 426

转载 c语言库函数和头文件以及gcc下编译工程

一:windows下.dll动态链接库(相当于linux下的.a和.so文件,是源文件经过编译后的文件)在Windows世界中,有无数块活动的大陆,它们都有一个共同的名字——动态链接库。现在就走进这些神奇的活动大陆,找出它们隐藏已久的秘密吧!   初窥门径:Windows的基石  随便打开一个系统目录,一眼望去就能看到很多扩展名DLL的文件,这些就是经常说的“动态链接库”,DL

2012-05-04 23:18:03 1827

转载 进制转换原理

一、十进制与二进制之间的转换1、十进制转换为二进制(1)整数部分方法1(除2取余法):每次将整数部分除以2,余数为该位权上的数,而商继续除以2,余数又为上一个位权上的数,这个步骤一直持续下去,直到商为0为止,最后读数时候,从最后一个余数读起,一直到最前面的一个余数。举例:将十进制的10转换为二进制第一步,将商10除以2,商5余数为0;第二步,将商5除以2,商2余数为1;第三步,将商2

2012-04-28 22:39:24 3528

原创 qsort实现原理与应用 指向函数的指针

标准库函数 qsort ,在 stdlib.h 中声明,其原型为: void qsort(void *base, int nelem, unsigned int width,                  int ( * pfCompare)( const void *, const void *)); 使用该函数,可以对任何类型的一维数组排序。该函数参数中,bas

2012-04-27 22:52:15 1516

原创 大树加法、乘法

#include #include #include #include using namespace std;#define MAXN 300  //大整数最大位数//c语言结构体没有方法,只能是数据的集合class Bign{private:int len; //大整数位数int pos[MAXN];//大整数的存储结构,pos[0]表示个位··

2012-04-26 23:50:04 2025

原创 KMP字符串匹配

#include #include using namespace std;string str,tar;int f[10000+10];void Fail () //失败函数{    f[0]=-1;                   for(int j=1;j    {        int m=f[j-1];             while(

2012-04-26 10:20:09 260

原创 归并排序和快速排序

#include #include #include #include void Qsort(int *a,int x,int y){//自顶向下 先求出a[x]的位置if(xint i=x,j=y;while(ii++;while(ij--; //若a只有一个元素,j--后等于x,故到递归出口while(j>x&&a[j]>a[x]) j--;if

2012-04-26 10:00:27 264

原创 JDBC总结

1.导入sql包import java.sql.*;2.加载数据库驱动  要将数据库的驱动路劲加载到相应的classpath中 classpath=.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;D:\Program Files\apache-tomcat-7.0.26\lib\servlet-api.jar;D:\app\

2012-04-26 09:49:41 327

原创 位运算取反、求绝对值

#include #include #include void swap(int *a,int *b){*a ^= *b; //a = a^b*b ^= *a;   //b = a^b = a^b^b = a*a ^= *b; //a = a^b = a^b^a = b//*a^=*b^=*a^=*b}int _abs(int a){int b;

2012-04-20 17:17:05 2605

转载 位运算

转载地址:http://www.cnblogs.com/xiaoxian1369/archive/2011/08/11/2134787.html1) int型变量循环左移k次,即a=a >16-k  (设sizeof(int)=16) (2) int型变量a循环右移k次,即a=a>>k |a  (3)整数的平均值 对于两个整数x,y,如果用 (x+y)/2 求平均值

2012-04-20 16:35:31 333

转载 C语言printf实现 double型的0.0

#include int main (){int i = 1;printf("%d-->%d-->%d-->%d",i++,i++,i++,i++);printf("最终的i == %d",i);return 0;}//输出结果://4-->3-->2-->1最终的i == 5/*printf的声明    int _cdecl printf(const

2012-04-19 22:53:02 1440

转载 JSP中response.sendRedirect和jsp:forward区别

JSP的重定向有两种:forward和sendRedirect,它们的原理以及区别是什么呢? 它们在使用上的区别有很多,那些都是表面现象,在理解了它们各自的原理以后,使用上的区别那就能容易掌握了。一、原理.1、 Forward这种方式是在服务器端作的重定向。服务器往client发送数据的过程是这样的:服务器在 向客户端发送数据之前,是先将数据输出到缓冲区,然后将缓冲区中数据

2012-04-11 22:00:53 5085

转载 centos将用户添加到sudo用户的方法

sudo的作用就是使当前非root用户在使用没有权限的命令 时,直接在命令前加入sudo,在输入自己当前用户的密码就可以完成root用户的功能,而不必在每次使用su -来回切换用户了。sudo的配置文件位于/etc/sudoers,需要root权限才可以读写。找到root ALL=(ALL) ALL这一行,在后面再加上一行就可以了(不用引号):“username ALL=(ALL) ALL

2012-03-13 10:27:29 1541

转载 liveCD安装ubuntu开机引导grub

启动Ubuntu光盘,选择LiveCD模式,进入之后选择进入终端,先在终端输入如下命令:sudo fdisk -l (注意是小写的L,不是数字的1,此步用于确定电脑中安装 Ubuntu 10.04的所在分区的位置,输入以后会输出类似如下信息,找到ID为83的那行,记住/dev/sdaX的情况,比如本人的电脑是/dev /sda7,以下就以此为例,你自己的请加以更改)Disk /dev/s

2012-02-17 10:49:09 7532

转载 大整数取模

(a + b) mod n = ((a mod n) + (b mod n)) mod n(a - b) mod n = ((a mod n) - (b mod n)) mod na * b mod n = ((a mod n)*(b mod n)) mod n

2011-11-17 22:34:22 481

转载 套接字编程基本的数据结构struct sockaddr_in, struct sockaddr,struct in_addr

一、结构体 struct sockaddr_in,  struct sockaddr,  struct in_addrstruct sockaddr_in,  struct sockaddr,struct in_addr,这是网络编程中常用的结构体,每次都记不住它们各自的成员是啥,需要临时查,为方便以后的查看,在这里总结下。struct sockaddr {unsigned short

2011-11-10 23:26:11 351

原创 tyvj P1014 惩罚游戏 区间动态规划

乘法游戏是在一行牌上进行的。每一张牌包括了一个正整数。在每一个移动中,玩家拿出一张牌,得分是用它的数字乘以它左边和右边的数,所以不允许拿第1张和最后1张牌。最后一次移动后,这里只剩下两张牌。  你的目标是使得分的和最小。  例如,如果数是10 1 50 20 5,依次拿1、20、50,总分是             10*1*50+50*20*5+10*50*5=8000  而拿50、

2011-11-01 21:58:50 652

原创 区间素数筛选法 joj 1928 Prime Distance

1928: Prime DistanceResultTIME LimitMEMORY LimitRun TimesAC TimesJUDGE3s8192K7223StandardThe branch of mathematics called number theory is about propertie

2011-10-31 14:03:03 677 1

原创 poj 1328 贪心

Radar InstallationTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 28579 Accepted: 6263DescriptionAssume the coasting is an infinite straight line. Land is

2011-10-29 13:13:51 467

原创 01背包问题中恰好为重量T

重量恰好为T:#include #include #include #include using namespace std;int T,M;int t[101];int m[101];int d[101][1001];int max;int main (){    while(scanf("%d%d",&T,&M)==2)    {

2011-10-28 12:12:20 573

原创 POJ 1007 DNA Sorting

DNA SortingTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 59510 Accepted: 23481DescriptionOne measure of ``unsortedness'' in a sequence is the number o

2011-10-27 15:09:35 281

原创 归并排序求逆序数

#include #include #include using namespace std;int cnt;void mergesort(int i,int j,int *a,int *b){    if(j-i>1)    {        int m=(i+j)/2;        mergesort(i,m,a,b);        merges

2011-10-27 14:11:30 285

原创 P1081最近距离

<br /> <br />描述 Description    在一块地上,有着n(1<=n<=2000) 头牛,输入n,再分别输入这n头牛的坐标(x,y) <br />(1<=x<=100000,1<=y<=100000),如果第i头牛与第j头牛间的距离最近,那么输出i和j<br /> <br />           <br /><br />          10 | . . . . . . . 3 . . . . .<br />           9 | . 1 . . 2 . . . . . .

2011-03-07 21:49:00 620

原创 1237: Periodic Strings

ResultTIME LimitMEMORY LimitRun TimesAC TimesJUDGE3s8192K1256350Standard<br /> A character string is said to have period k if it can be formed by concatenating one or more repetitions of another string of length k. For example,the string "abcabca

2010-11-27 20:27:00 526

原创 1198: Risk

ResultTIME LimitMEMORY LimitRun TimesAC TimesJUDGE1s8192K622290StandardA friend of you is doing research on the Traveling Knight Problem (TKP)where you are to find the shortest closed tour of knight moves that visitseach square of a given set of n

2010-11-26 21:06:00 287

原创 宽度优先搜索1185: Knight Moves

ResultTIME LimitMEMORY LimitRun TimesAC TimesJUDGE1s8192K622290StandardA friend of you is doing research on the Traveling Knight Problem (TKP)where you are to find

2010-11-26 11:48:00 430

原创 1182: Lotto 快排

ResultTIME LimitMEMORY LimitRun TimesAC TimesJUDGE1s8192K751355Standard<br />In a Lotto I have ever played, one has to select 6 numbers from the set {1,2,...,49}. A popular strategy to play Lotto - although it doesn't increase your chanceof winning -

2010-11-25 22:47:00 263

原创 1600: Big Mod mod运算的性质, a^n合同与a模m的积

ResultTIME LimitMEMORY LimitRun TimesAC TimesJUDGE3s8192K1707322Standard<br />Calculate<br /> <br /><br /> <br />for large values of B, P, and M using an efficient algorithm. (That's right, this problem has a time dependency !!!.)<br />Inpu

2010-11-24 22:53:00 515

原创 堆排序

<br />#include <stdio.h><br />int v[100];<br />int n;<br />void build (int i,int e)<br />{<br />    int j=i;<br />    while(2*j<=e)         //防止越界,考虑单支情况<br />    {<br />        int l;<br />        if(j*2<e&&v[2*j]<v[2*j+1])  l=2*j+1;    

2010-11-23 10:56:00 174

原创 1424: Coin Change dp

<br /> ResultTIME LimitMEMORY LimitRun TimesAC TimesJUDGE3s8192K579188Standard<br />Suppose there are 5 types of coins: 50-cent, 25-cent, 10-cent, 5-cent, and1-cent. We want to make changes with these coins for a given amountof money. <br /> 

2010-11-21 22:44:00 353

原创 1066: Fire Net II 深搜

ResultTIME LimitMEMORY LimitRun TimesAC TimesJUDGE3s8192K547216Standard<br />1st JOJ Cup Online VContest Warmup Problem<br />Suppose that we have a square city with straight streets. A map of a city is a square board with n rows and n columns, each repre

2010-11-17 14:35:00 294

原创 1167: How Many Eggs Do I Have? 秦九韶定理

ResultTIME LimitMEMORY LimitRun TimesAC TimesJUDGE3s8192K2050454Standard<br />1st Jilin University ACM International Collegiate Programming Contest<br />Assume you are needed to count a basket of eggs. Even though counting is very easy but unfortunately

2010-11-17 13:53:00 580

空空如也

空空如也

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

TA关注的人

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