题目:poj 1679 The Unique MST
题意:给你一颗树,让你求最小生成树和次小生成树值是否相等。
分析:这个题目关键在于求解次小生成树。
方法是,依次枚举不在最小生成树上的边,然后添加到最小生成树上,然后把原树上添加了之后形成环的最长的边删去,知道一个最小的。就是次小生成树。
这些需要的都可以在求解最小生成树的时候处理出来。
AC代码:
#inc...
分类:
其他好文 时间:
2014-11-04 11:08:16
阅读次数:
194
Write a program to solve a Sudoku puzzle by filling the empty cells.
Empty cells are indicated by the character '.'.
You may assume that there will be only one unique solution.
A sudoku puzzle....
分类:
其他好文 时间:
2014-11-01 21:52:53
阅读次数:
250
Given an arraySofnintegers, are there elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in the array which gives the sum of ...
分类:
其他好文 时间:
2014-11-01 06:12:04
阅读次数:
311
Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:Elemen...
分类:
其他好文 时间:
2014-11-01 06:12:01
阅读次数:
214
unique()函数是一个去重函数,STL中unique的函数 unique的功能是去除相邻的重复元素(只保留一个),还有一个容易忽视的特性是它并不真正把重复的元素删除。他是c++中的函数,所以头文件要加#include,具体用法如下: int num[100]; unique(num,mun+n)...
分类:
其他好文 时间:
2014-10-31 21:55:58
阅读次数:
198
【题目】
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d =
target? Find all unique quadruplets in the array which gives the sum of target.
Note:
...
分类:
其他好文 时间:
2014-10-31 12:02:18
阅读次数:
261
PV(访问量):即Page View, 即页面浏览量或点击量,用户每次刷新即被计算一次。 UV(独立访客):即Unique Visitor,访问您网站的一台电脑客户端为一个访客。00:00-24:00内相同的客户端只被计算一次。 IP(独立IP):指独立IP数。00:00-24:00内相同IP地址之...
分类:
Web程序 时间:
2014-10-30 18:56:27
阅读次数:
259
约束(constraint):对创建的表的列属性、字段进行的限制。诸如:not null/unique/primary key/foreign key/check
作用范围:
①列级约束只能作用在一个列上
②表级约束可以作用在多个列上(当然表级约束也可以作用在一个列上)
定义方式:列约束必须跟在列的定义后面,表约束不与列一起,而是单独定义。
— —...
分类:
数据库 时间:
2014-10-29 00:12:18
阅读次数:
467
一、key与primary key区别CREATE TABLE wh_logrecord (logrecord_id int(11) NOT NULL auto_increment,user_name varchar(100) default NULL,operation_time datetime...
分类:
数据库 时间:
2014-10-28 17:05:04
阅读次数:
251
create table Document(ID int not null,Name nvarchar(255) not null,Body nvarchar(max) not null);gocreate unique index uq_ix_for_Document --#这里一定要加一个not...
分类:
数据库 时间:
2014-10-26 21:01:06
阅读次数:
177