题意:求一个无向图的,去掉两个不同的点后最多有几个连通分量。
思路:枚举每个点,假设去掉该点,然后对图求割点后连通分量数,更新最大的即可。算法相对简单,但是注意几个细节:
1:原图可能不连通。
2:有的连通分量只有一个点,当舍去该点时候,连通分量-1;
复习求割点的好题!
#include
#include
#include
using namespace std;
i...
分类:
其他好文 时间:
2014-05-23 07:56:52
阅读次数:
317
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.Tex...
分类:
其他好文 时间:
2014-05-22 12:36:05
阅读次数:
243
首先分成一半2^17和2^18,并且把其中一半变成相反数,然后枚举一半二分查找另一半,在找到的位置前后也找找。
这里用到了二级排序,有很多细节要处理,不多说了。
巨坑的一个地方就是,不能用系统的abs,要自己手写,简直坑死。。
#include
#include
#include
#include
using namespace std;
typedef long long ...
分类:
其他好文 时间:
2014-05-22 12:01:31
阅读次数:
220
//3、假定有20个 有序 数组,每个数组有500个数字,数字类型32位uint数值,现在需要取出这10000个数字中最大的500个,怎么做?
#include
using namespace std;
struct node
{
int data;
int next;
};
node obj[20];
void sift(int k,int m,int ...
分类:
其他好文 时间:
2014-05-22 10:54:48
阅读次数:
292
Sol:就是求第N项的斐波那契数。矩阵乘法+快速幂
#include
#include
#include
#include
using namespace std;
#define LL long long
struct Mat{
LL f[2][2];
};
LL MOD = 10000;
Mat mul(Mat a,Mat b)
{
LL i,j,k...
分类:
其他好文 时间:
2014-05-22 10:46:35
阅读次数:
191
//编写一个程序,让用户可以一次性输入任意多行文本
/*
* OutPutTest.cpp
*
* Created on: 2014年5月19日
* Author: John
*/
#include
#include
#include
#define COL_WIDTH 80
using namespace std;
int main(){
ofstrea...
分类:
编程语言 时间:
2014-05-22 10:42:34
阅读次数:
350
节点形态:
实现:
/******************************************
二叉树的二叉链表存储
by Rowandjj
2014/5/18
******************************************/
#include
using namespace std;
/*二叉树的二叉链表存储表示*/
typedef int T...
分类:
其他好文 时间:
2014-05-22 07:03:21
阅读次数:
229
jQuery函数的第二个参数可以指定DOM元素的搜索范围。
第二个参数可分为以下类型
DOM referencejQuery wrapperdocument
代码示例
// search within all form elements, using a wrapper for context,
// alerts "8...
分类:
Web程序 时间:
2014-05-20 16:32:25
阅读次数:
377
#include
#define MAX 100
using namespace std;
class Sample
{
int a[MAX];
int b[MAX];
int n;
friend class Process;
public:
Sample(){n=0;}
};
cla...
分类:
其他好文 时间:
2014-05-20 15:24:05
阅读次数:
345
测试源码:
//测试派生类的构造函数的调用顺序何时调用
//Fedora20 gcc version=4.8.2
#include
using namespace std;
class base
{
public:
base()
{
cout<<"base created!"<<endl;
}
~base()
{
cout<<"base destroyed!"<<en...
分类:
编程语言 时间:
2014-05-20 14:12:21
阅读次数:
322