现在位置: 首页 > Wemduemia发表的所有文章
  • 09月
  • 03日
综合 ⁄ 共 2119字 评论关闭
题意:一个有向图,现在问将图中的每一个点都划分到一个环中的最少代价(边权和)。 思路:拆点,建二分图,跑最小费用最大流即可。若最大流为n,则说明是最大匹配为n,所有点都参与,每个点的入度和出度又是1,所以就是环。 /********************************************************* file name: hdu1853.cpp author : kereo create time: 2015年02月16日 星期一 17时38分51秒 *********************************************************/ #include<iostream> #include<cstdio> #include<cstring> #i......
阅读全文
  • 08月
  • 14日
综合 ⁄ 共 1267字 评论关闭
题目描述:               在一个2k´2k个方格组成的棋盘中,恰有一个方格与其他方格不同,称该方格为特殊(残缺)方格,且称该棋盘为一特殊棋盘。   根据特殊方格出现的位置,有种 4k不同的特殊棋盘。   棋盘覆盖问题:用 4 种不同形态的 L 型骨牌覆盖给定的特殊棋盘上除特殊方格以外的所有方格,且任何2个 L 型骨牌不得重叠覆盖。       分治法:2k´2k棋盘覆盖问题--4个 2k-1´2k-1棋盘覆盖问题 将2k×2k棋盘分割为4个2k-1×2k-1 子棋盘。特殊方格必位于4个较小子棋盘之一中,其余3个子棋盘中无特殊方格。为了将这3个无特殊方格的子......
阅读全文
  • 10月
  • 22日
综合 ⁄ 共 483字 评论关闭
在《Bayesian computation with r》第21页,作者描绘了一离散分布图形,R代码如下: p = seq(0.05, 0.95, by = 0.1) prior = c(1, 5.2, 8, 7.2, 4.6, 2.1, 0.7, 0.1, 0, 0) prior = prior/sum(prior) plot(p, prior, type = "h", ylab="Prior Probability") 粗略的用SAS表达: data test;   input prior p @@;   retain sprior 0;   sprior=prior+sprior;   cards; 1 0.05 5.2 0.15 8 0.25 7.2 0.35 4.6 0.45 2.1 0.55 0.7 0.65 0.1 0.75 0 0.85 0 0.95 ; run; proc sql;    create table test1 as     select prior,p,         pr......
阅读全文
  • 10月
  • 19日
综合 ⁄ 共 1958字 评论关闭
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 "bbbbb" the longest substring is "b", with the length of 1. 简译:求解最长不重复子串的长度。 class Solution { public: int lengthOfLongestSubstring(string s) { const char *hash[256] = {}; const char *str = s.c_str(); const char *head = str; int max_len = 0......
阅读全文
  • 05月
  • 25日
综合 ⁄ 共 1511字 评论关闭
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(actionTap)]; [aView addGestureRecognizer:tap]; [tap release]; 以上是很简单的给一个UIView 添加 单击手势的方法. 下面我们来改进他支持代码快 先建立一个类别 @interface UIView (XY) -(void) addTapGestureWithTarget:(id)target action:(SEL)action; -(void) addTapGestureWithBlock:(void(^)(void))aBlock; -(void) removeTapGesture; @end 代码块方法,这里要注意的是,我们得给UIView,添加一个blo......
阅读全文
  • 05月
  • 14日
综合 ⁄ 共 9869字 评论关闭
ASP.NET编写简单的中文分词程序     词库大概有5万多词语(google能搜到,类似的词库都能用),我摘要如下: 地区    82 重要    81 新华社    80 技术    80 会议    80 自己    79 干部    78 职工    78 群众    77 没有    77 今天    76 同志    76 部门    75 加强    75 组织    75 第一列是词,第二列是权重.我写的这个分词算法目前并未利用权重. 二、设计思路 算法简要描述: 对一个字符串S,从前到后扫描,对扫描的每个字,从词库中寻找最长匹配.比如假设S=我是中华人民共和国公民,词库中有中华人民共和国,中华,公......
阅读全文
  • 04月
  • 23日
综合 ⁄ 共 500字 评论关闭
一、Unix标准化 1、ANSI C ANSI C标准的意图是提供C程序的可移植性,使其能适合于大量不同的操作系统,而不只是Unix。此标准不仅定义了C程序设计 语言的语法和语义,也定义了其标准库。 按照该标准定义的各个头文件,可将该库分成15区。 2、IEEE POSIX POSIX是一个由IEEE制订的标准族。 3、X/Open XPG3 4、FIPS   二、Unix实现 标准只是界面的规格说明。标准由制造商采用,然后转变为具体实施。 1、SVR4 2、4.3+BSD   三、限制 有三种类型的功能是必须的: 编译时间选择项 编译时间限制 运行时间限制 1、AN......
阅读全文
  • 02月
  • 13日
综合 ⁄ 共 415字 评论关闭
第一方式:     参数之间必须使用&amp;。&amp;是&在xml中转义字符 Xml代码   <result name="error" type="redirect">         /login.jsp?userId=${orgStrucUser.userId}&amp;error=1   </result>        第二方式: Java代码   <result name="error" type="redirect">             <param name="location">/login.jsp</param>             <param name="userId">${orgStrucUser.userId}</param>             <param name="error">1&l......
阅读全文
  • 01月
  • 22日
综合 ⁄ 共 507字 评论关闭
TAG 数论   简单的数学题。设 n+.. +(n+k)=X, n>0,k>0 有 (2n+k)(k+1)=2X          k(k+1)   <2X                 k^2<2X                     k<sqrt(2X)   枚举k到sqrt(2X)就行了 /* source code of submission 421009, Zhongshan University Online Judge System */ #include <stdio.h> #include <math.h> int T; int no,n; int cal(int n) { int ret=0; for (int i=1; i<=int( sqrt(2.0)*sqrt(n+0.0) ); ++i) { if ( (2*n)%(i+1)==0 && (2*n/(i+1)-i) >=2 &a......
阅读全文
  • 01月
  • 19日
综合 ⁄ 共 388字 评论关闭
32.   淘宝: 在现代 web 服务系统的设计中,为了减轻源站的压力,通常采用分布式缓存技术,其原 理如下图所示,前端的分配器将针对不同内容的用户请求分配给不同的缓存服务器向用 户提供服务。         分配器 /              |           \ 缓存           缓存  . ..缓存 服务器 1  服务器 2 ...服务器 n 1)请问如何设置分配策略,可以保证充分利用每个缓存服务器的存储空间(每个内容只在一个缓存服务器有副本) 2)当部分缓存服务器故障,或是因为系统扩容,导致缓存服务器的数量动态减少或增加时,你的分配策略是否可以保证......
阅读全文
  • 01月
  • 18日
综合 ⁄ 共 331字 评论关闭
socket(); bind(); listen() while(1) {        accept();       if( fork() ==0 )       {                if( fork() == 0 )                {                    while(1)                         {                             read();                           process();                           write();                         }                   close();                    exit();                }              else              {                        exit(0);//子进程退出,孙子进程的父进程变......
阅读全文
  • 01月
  • 14日
综合 ⁄ 共 2249字 评论关闭
Flip Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 26252   Accepted: 11333 Description Flip game is played on a rectangular 4x4 field with two-sided pieces placed on each of its 16 squares. One side of each piece is white and the other one is black and each piece is lying either it's black or white side up. Each round you flip 3 to 5 pieces, thus changing the color of their upper side from black to white and vice versa. The pieces to be flipped are chosen ......
阅读全文