贴模板~KM算法引进了顶标函数,不断缩小这个顶标来让相等子图的可能范围扩大#include#include//KM 复杂度O^3 using namespace
std;const int N=200;int lx[N],ly[N];//顶标函数int w[N][N];//图bool vix[N],...
分类:
其他好文 时间:
2014-06-02 21:53:12
阅读次数:
334
Linq是C#3.0引入的,在C#2.0实现从集合中过滤符合条件的记录实现方式。
假设有一个Book类,以及一个Book类的集合,现在需要从集合中查找出单价大于50的Book。 1、固定查询字段的实现方式: Book.cs类:using
System;using System.Collec...
分类:
其他好文 时间:
2014-06-02 21:43:50
阅读次数:
309
【题目】原文:1.3 Design an algorithm and write code
to remove the duplicate characters in a string without using any additional
buffer. NOTE: One or two add...
分类:
其他好文 时间:
2014-06-02 21:32:04
阅读次数:
284
设FA为A的牌中数字异或和,FB为B的。则有性质:ans =
(所有的(A&B=0)个数 +
(FA=FB且A&B=0)的个数)/2。即所有的FA>FB的个数(除2是因为这里FA>FB的个数等于FA#include #include
#include #include using namespace...
分类:
其他好文 时间:
2014-06-02 20:01:12
阅读次数:
195
BFS+状态压缩,做了很多状态压缩了。今晚把八数码问题给搞定了。 1 #include 2
#include 3 #include 4 #include 5 using namespace std; 6 7 typedef struct node_st
{ 8 int x, y, ...
分类:
其他好文 时间:
2014-06-02 17:14:38
阅读次数:
232
二分图bipartite
使用BFS广度优先判断一个图是否是二分图。基本图操作。
参考
http://www.geeksforgeeks.org/bipartite-graph/
#pragma once
#include
#include
#include
using namespace std;
class CheckwhetheragivengraphisBipa...
分类:
其他好文 时间:
2014-06-01 15:03:24
阅读次数:
288
在开发中可能需要一个方法两种类型的数据去访问和使用,C++中诞生了泛型的概念, 1
#include 2 using namespace std; 3 template 4 T min(const T(&array)[size]) {
5 //寻找数组中最小的元素 6 T min...
分类:
编程语言 时间:
2014-06-01 12:34:28
阅读次数:
243
用于大型程序的工具--命名空间[续3]六、重载与命名空间 正如我们所见,每个命名空间维持自己的作用域,因此,作为两个不同命名空间的成员的函数不能互相重载。但是,给定命名空间可以包含一组重载函数成员。1、候选函数与命名空间 命名空间对函数匹配有两个影响。一个影响是明显的:using声明或using 指示可以将函数加到候选集合。另一个影响则微妙得多。 正如前节所见,有一个或多个类类型形参的函数的名字查...
分类:
编程语言 时间:
2014-06-01 09:15:16
阅读次数:
353
#include
using namespace std;
//template
class Int
{
friend ostream& operator
public:
Int(int i):m_i(i)
{
}
Int& operator++()
{
++(this->m_i);
r...
分类:
其他好文 时间:
2014-06-01 09:00:22
阅读次数:
209
【题目】
A message containing letters from A-Z is being encoded to numbers using the following mapping:
'A' -> 1
'B' -> 2
...
'Z' -> 26
Given an encoded message containing digits, determine the total number of ways to decode it.
For example,
Given encoded ...
分类:
其他好文 时间:
2014-06-01 08:59:37
阅读次数:
258