自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(72)
  • 资源 (3)
  • 收藏
  • 关注

原创 delphi调用cxf生成的webservice出错 message part name was not recognized.(does it exist in service wsdl?)

delphi调用cxf生成的webservice出错 message part name was not recognized.(does it exist in service wsdl?)解决方案:把delphi生产的文件的最下面d

2014-08-09 17:48:46 14632

转载 二进制求1的个数(转载自http://www.cnblogs.com/graphics/)

算法-求二进制数中1的个数问题描述任意给定一个32位无符号整数n,求n的二进制表示中1的个数,比如n = 5(0101)时,返回2,n = 15(1111)时,返回4这也是一道比较经典的题目了,相信不少人面试的时候可能遇到过这道题吧,下面介绍了几种方法来实现这道题,相信很多人可能见过下面的算法,但我相信很少有人见到本文中所有的算法。如果您上头上有更好的算法,或者本文

2011-10-26 18:41:00 1138

原创 poj 2503 Babelfish

本来想试试那个ELFHash算法的功力的,哪知道错了,还是我三行的hash好。。。#include #include #include #include using namespace std;map M;int ELFHash(const char * st

2011-10-11 00:09:49 500

原创 3547 The Boss on Mars

#include #include #include using namespace std;typedef long long LL;const int MAXN = 10001;const LL M = 1000000007;int factor[10001]

2011-10-08 21:30:28 696

原创 求树的直径

偶尔看到的题目,顺便练习下指针。。#include using namespace std;typedef struct node { int data; int child_num; node **childs;}*tree;/*求tree t的高

2011-10-07 21:35:28 1370 2

原创 zoj 3540 Adding New Machine

=。=!全STL搞的。。离散化后扫描线+Set..#include #include #include #include using namespace std;#define mp(a,b) make_pair(a,b)typedef long lo

2011-10-04 22:24:46 1223

原创 design pattern

Adapter   Facade   Composite  Bridge  Singleton   Observer   Mediator    Proxy   Chain of Responsibility     FlyweightBuilder   Fact

2011-09-05 19:58:53 389

原创 android:cha1.3 常用控件的设置

<br />1.其实ADT这个插件已经很强大了,设计一个Application时可以用图形进行设置,但我还是喜欢用代码布局。<br />2.在使用Intent方法进行传递数据时,要注意名字的大小写要一致。(弄了好几个小时才发现)<br />3.在使用menu按钮功能时,要写毁掉函数onCreateOptionsMenu和onOptionsItemSelected这两个方法。<br />4.在编写代码时避免直接赋值,如在给控件赋Text的时候最好把内容写到res/strings中去,在应用R.string.n

2011-02-27 18:03:00 553

原创 android:cha1.2 通过Intent实现Activity之间的通信

<br />要点:<br />     /**<br /> * 通过Intent进行Activity之间的通信<br /> * 1.可以在多个Activity之间进行通信,可以在不同应用程序中<br /> * 2.需要在AndroidMainfest中注册<br /> * 3.添加一个Activity类需要集成Activity和复写onCreate<br /> * 4.设置一个listener需要implements OnClickListener,然后Override onClick<br /> * <b

2011-02-27 11:45:00 671

原创 android:cha1.1 初步Activity

<br />/**<br /> * 编写Activity要点<br /> * 1.一个Activity就是一个类,并且这个类要继承Activity<br /> * 2.需要复写onCreate方法<br /> * 3.每一个Activity都需要在AndroidMainfest.xml文件中进行配置<br /> * 4.为Activity添加必要的控件<br /> * @author wb<br /> *<br /> */<br /> <br /> 

2011-02-26 22:31:00 597

原创 杭州地区赛的遗憾 Rotational Painting

<br />题目其实稍微注意一下就知道怎么搞了。<br />重心+凸包!<br />然后枚举相邻凸点就行<br /> <br />#include <iostream><br />#include <algorithm><br />using namespace std;<br />#define N 50005<br />/*==================================================*/ <br />| Graham 求凸包 O(N * logN) <br />|

2010-11-07 15:08:00 1115

原创 杭州-打酱油!

<br /><br />在杭州的两天都是下着雨的,阴霾的天气不及现在我的mood。<br />    星期五出发来杭州,也算倒霉了,想动车去。。然后坐车到了东站,结果车票已经卖完。<br />然后决定大巴去了。。去了客运中心,发现大巴在南站坐。。又悲剧。。11点多出来,2点才从宁波出发。<br />在杭州酒店里遇到了正在杭州开会的班主任。<br />    星期六,是个下雨天,简单开幕式后乘车去阿里巴巴,坐了一个多小时后才到它的总部,然后<br />直接上光明鼎参观,很震撼!阿里巴巴的工作氛围很好,真希望以

2010-10-24 20:15:00 977

原创 打酱油了。。。

<br />:(

2010-10-24 18:25:00 542 3

原创 DP(斜率优化)

 Print Article悲剧。不是数组写小就是小于号写反。。。明天比赛,期待RP爆发!#include #include using namespace std;const int N=500010;__int64 dp[N];__int64 sum[N],dia;int Q[N];int n,m;__int64 cal(int c,int k){    return dp[c]+(sum[k]-sum[c])*(sum[k]-sum[c])+m;}__int64 Y(int c){    return

2010-10-23 22:48:00 787 3

原创 HDU 2295(裸DLX要超时,需要剪枝)

<br /> <br />多了Judge()要是depth+judge()都大于count就直接返回false;<br /> <br /><br />#include <iostream><br />#include <cmath><br />#include <stdio.h><br />using namespace std;<br /> <br />const int N=100;<br />struct node{<br />int L,R,D,U,col;<br />}dia[N*N];<br /

2010-10-15 23:00:00 879

原创 DLX PKU3740

<br />看了比我还小,但能力无法比较的陈丹琦 《Dancing Links的应用》 <br />之前看了算法大师 Knuth的论文,感觉很巧妙,但不知道如何实现,然后看了CDQ之后,找了一题最裸的DLX的题开始编。。然后照着她的模板打下去。。。后来怎么交都是错的。特别是她的Recover()那边不知道是写错了还是我不理解。。。改了那里之后就A了。。<br /> <br /> <br /><br />#include <iostream><br />#include <stdio.h><br />usin

2010-10-15 14:18:00 955 2

原创 啊啊啊!!本来CF34可以AK的。。。

<br />while(true)<br />RP++;

2010-10-11 23:56:00 536 1

原创 FZU 网赛最后K题 Three kingdoms(有点卡常数的)

<br />题目意思大致是:给出N个点,然后给出方向向量,然后N个点沿着方向向量引出射线,在m个点(敌人),凡是被射线射到的要死,问最后死多少人。。 n,m都是(0,10000]的。<br /> 显然,时间复杂度很明显,不是O(n)就是O(nlog(n) ),我做的是O(nlog(n) )复杂度的,首先我们想到的是每一个射线的起点与X * Y这个平面上延着向量的方向或反方向有个交点(特殊情况,如方向向量平行x * y的话 我们可以通过反转避免);  然后我们用O(n)的复杂度处理了起点,然后对所有在X上的映

2010-10-11 11:50:00 760

原创 九月的哈尔滨

先写个标题吧!

2010-09-28 12:03:00 2052 6

原创 PKU 3678 Katu Puzzle(2-SAT)

这几天看了2-SAT有关的论文,也做了一些相关的题目,个人的一点体会。所谓的2-SAT就是给出一对矛盾,既他们是不可能相处在一起的,比如有家庭A,B。A家庭有a0,a1两个人,B家庭有b0,b1两个人,现在要求每个家庭出席一个人组成一个集合,要是没有任何约束条件,我们可以有4种选择满足条件,即(a0,b0) (a0,b1),(a1,b0),(a1,b1)。但是我们要是给出一个约束条件 比如说a1与b1不能同时出席,即是相当于不能兼容的一队,有此,我们可供选择的就减少了,减少了虽然是(a1,b1)这种选择,但

2010-09-15 19:43:00 680 1

原创 天津网络预选赛 1007-Giant_For(线段树+set)

已行x区间内最大的列为键值构建线段树,再以set维护每个点中的y值。find的话查找【x+1,n】中最小的点,该点的最大列值是大于y的;然后返回的是x的位置,再从x的set里取出最小的一个比y大的值!#include#include#include#includeusing namespace std;struct Seg{int l,r,max_col;};struct Q{char ch[8];int row,col;};Q q[200010];Seg seg[200010*3];int dia[200

2010-09-12 18:42:00 989 2

原创 HDU 2419 Boring Game

十分悲剧,无线蛋疼,昨天纠结一天! 就因为modify(que[i].v1,ri[que[i].v1][cnt[que[i].v1]],ri[que[i].v1][cnt[que[i].v1]-1])+cnt[que[i].v1]用modify(que[i].v1,ri[que[i].v1][cnt[que[i].v1]],ri[que[i].v1][-- cnt[que[i].v1]])代替,估计是调用函数的执行顺序有关系;情何以堪!#include#include#include#include#inc

2010-09-09 11:02:00 813

原创 PKU1743 Musical Theme 楼教主男人八题之一

<br /> Musical ThemeTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 6021 Accepted: 2127<br />DescriptionA musical melody is represented as a sequence of N (1<=N<=20000)notes that are integers in the range 1..88, each representing a key on the pia

2010-09-07 14:20:00 1399

原创 ZOJ3395 Stammering Aliens 二分+后缀数组

Stammering AliensTime Limit: 5 Seconds      Memory Limit: 65536 KBDr. Ellie Arroway has established contact with an extraterrestri

2010-09-04 09:01:00 1343 1

原创 Counting Sequences

<br />Counting SequencesTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/65536 K (Java/Others)<br />Total Submission(s): 337    Accepted Submission(s): 115<br /><br /><br />Problem DescriptionFor a set of sequences of integers{a1,a2,a3,...an},

2010-09-03 21:25:00 536

原创 hdu3584 Cube 树状数组

<br /> Cube<br />Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others)<br />Total Submission(s): 48    Accepted Submission(s): 32<br />Problem DescriptionGiven an N*N*N cube A, whose elements are either 0 or 1. A[i, j, k] mea

2010-08-31 21:04:00 533

原创 hdu3564 Another LIS (线段树处理后的裸LIS)

 Another LISTime Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 258    Accepted Submission(s): 45Problem DescriptionThere is a sequence firstly empty. We begin to add number from 1 to N to the sequence,

2010-08-30 18:38:00 1092

原创 Max Sum of Max-K-sub-sequence

<br />Problem DescriptionGiven a circle sequence A[1],A[2],A[3]......A[n]. Circle sequence means the left neighbour of A[1] is A[n] , and the right neighbour of A[n] is A[1].<br />Now your job is to calculate the max sum of a Max-K-sub-sequence. Max-K-sub-

2010-08-30 11:37:00 794

原创 Minimal search cost DP+平行四边形优化

Minimal search costTime Limit : 10000/4000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 19   Accepted Submission(s) : 12Font: Times New Roman | Verdana | GeorgiaFont Size: ← →Problem Description  As we know, we need to spe

2010-08-29 13:15:00 1713

原创 hdu 3506Monkey Party(环形DP+平行四边形优化)

<br /><br />#include<iostream><br />using namespace std;<br /> <br />const int N=2010;<br />int sum[N];<br />int n;<br />int dia[N];<br />int s[N][N];<br />int dp[N][N];<br /> <br />void init()<br />{<br />int i;<br />sum[0]=0;<br />memset(dp,0xf,sizeof(dp

2010-08-24 22:07:00 1377 1

原创 zju3381Osaisen Choudai!

<br />dp+线段树;<br />dp[i] = s[i] + max{dp[i + j] | x[i] ≤ j < y[i]}<br />用线段数维护max。<br /> <br /> <br />#include<iostream><br />using namespace std;<br /> <br />const int N=50000;<br />struct node<br />{<br />int left,right;<br />int ma;<br />};<br />struct

2010-08-23 21:18:00 554

原创 hdu 字典树Ancient Printer

<br />跟着别人做也会被误导的啊,这题做掉的人很快很多,以为排排序之类的就会出来的,后来还拼命的在往简单的想,导致悲剧无限。<br />后来乱七八糟搞了下,原来是最简单的字典树;<br />思路:我们简单的想象一下,把所有要打印的东西构建成一颗字典树的话,若最后要求的是最后打印过的东西都要删掉的话,我们要在树上走的次数是所有的边都需要走两次。但现在是最后一次打印之后不需要DELETE,就是说最后一次到达叶子结点时不需要返回到根结点,于是,我们贪心的可以把最长的一条到达叶子的路放在最后(只需要走一次)。<

2010-08-16 21:08:00 574

原创 A Game with Colored Balls 郁闷,一个早上加一个晚上=Wa (再加一早上 AC)

#include#include#include#include#includeusing namespace std;#define N 10000002struct node{char ch;int pos,num,pre,next;friend bool operator{if(a.num==b.num)return a.poselsereturn a.num>b.num;}};struct sun{int pos,pre,next;};node dia[N+1],tt,pp;char s[N+1];

2010-08-14 23:28:00 627

原创 伸展树(转载http://acm.tju.edu.cn/blog/?p=85)

<br /><br />前段日子写过 treap 与 左偏树, 这两天又看了伸展树小有心得就在此记下来以备来日参考<br /> <br />左偏树是一个斜堆,而treap 是 tree 与 heap 的混合产物即是一个堆又一个二叉查找树,代码量很小易调试很合适上场比赛。但有些问题比如较复杂的操作上面的这些数据结构搞不定的话我们可以换 splay 来试试。<br /> <br />splay作为一个二叉排序树所具有特点用一句来概述就是“可以让你把指的结点放在树根的位置或者作为树根的儿子”很多参考资料都会这么介

2010-08-08 20:53:00 2238 1

原创 TreeView笔记(temp)

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.IO;namespace TreeView{    public partial class Form1 : Form    {  

2010-08-07 00:33:00 593 1

原创 基础线段树

<br /> <br />Balanced Lineup<br />Time Limit:5000MS  Memory Limit:65536K<br />Total Submit:35 Accepted:22 <br />Case Time Limit:2000MS<br />Description<br />For the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) always line up in the same order.

2010-08-03 15:08:00 476

原创 Color a Tree

<br />Poj2054 Color a Tree2008-09-14 23:42Color a TreeTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 2095 Accepted: 564<br />DescriptionBob is very interested in the data structure of a tree. A tree is a directed graph in which a special node

2010-07-19 21:59:00 756

原创 Color a Tree

<br />Poj2054 Color a Tree2008-09-14 23:42Color a TreeTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 2095 Accepted: 564<br />DescriptionBob is very interested in the data structure of a tree. A tree is a directed graph in which a special node

2010-07-19 21:59:00 987

原创 在ADO.NET编写事务

1新建一个Windows应用程序项目2向窗体添加3个标签、3个textbox和一个buttom3为buttom按钮添加一个click事件。添加以下代码  using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawin

2010-05-29 16:01:00 348

原创 在ADO.NET编写事务

1新建一个Windows应用程序项目2向窗体添加3个标签、3个textbox和一个buttom3为buttom按钮添加一个click事件。添加以下代码  using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawin

2010-05-29 16:01:00 388

c#抽奖程序

程序通过VS2010,使用C#开发,奖项设置通过配置文件实现,适合C#练手的程序!

2014-07-15

android 驾校理论模拟考试系统

对于SQLite数据库的操作就Activity练习是个不错的例子,希望能帮助大家更好的掌握android的开发。

2011-04-06

C++作业 饭卡程序设计

饭卡程序设计!C++作业 饭卡程序设计!C++作业 饭卡程序设计

2010-01-11

空空如也

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

TA关注的人

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