题目大意:给你一个n,m,k。n行,m列。然后给你每一行的总和,与每一列的总和,让你在这个n*m的矩阵里面填一个小于等于k的数字,使得满足每一列,每一行的和。如果没有输出“Impossible”,有多解输出“Not
Unique”,有唯一的解输出“Unique”,并输出他的解。
从源点到每一行的和建边容量为它的总和,从汇点到列建边容量为它的总和。然后行到列建边容量为数据上限K。然后求是否存在...
题意:给定完全无向图,求其中m个子节点,要求Sum(edge)/Sum(node)最小。思路:由于N很小,枚举所有可能的子节点可能情况,然后求MST,memset()在POJ里面需要memory头文件。#include #include #include #include #include #inc...
分类:
其他好文 时间:
2014-08-18 18:30:52
阅读次数:
244
A pair of numbers has a unique LCM but a single number can be the
LCM of more than one possible pairs. Forexample 12 is the
LCM of (1, 12), (2, 12),
(3,4) etc. For a given positive integer N, the ...
分类:
其他好文 时间:
2014-08-18 16:25:24
阅读次数:
240
Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5 unique BST's...
分类:
其他好文 时间:
2014-08-18 00:03:13
阅读次数:
189
10.42 使用list的算法实现排序和删除重复元素。#include#include#include#includeusing namespace std;void elimDup(list &words){ words.sort(); words.unique();}bool isS...
分类:
其他好文 时间:
2014-08-17 22:39:52
阅读次数:
269
Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T....
分类:
其他好文 时间:
2014-08-17 17:03:22
阅读次数:
184
Follow up for "Unique Paths":
Now consider if some obstacles are added to the grids. How many unique paths would there be?...
分类:
其他好文 时间:
2014-08-17 15:39:42
阅读次数:
221
multimap和map的关系和multiset和set关系一样,multimap允许有重复的键值,它在使用底层数据结构红黑树用,插入操作用的是insert_equal,而不是insert_unique。...
分类:
其他好文 时间:
2014-08-17 11:46:12
阅读次数:
262
题目:
You are given a binary tree with unique integer values on each node. However, the child pointers on each node may point to any other node in the tree including itself, introducing cycles into the...
分类:
其他好文 时间:
2014-08-17 09:11:11
阅读次数:
301
Given a set of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Thesamerepeated num...
分类:
其他好文 时间:
2014-08-16 17:03:50
阅读次数:
174