传送门:The Unique MST题意:判断最小生成树是否唯一。分析:先求出原图的最小生成树,然后枚举删掉最小生成树的边,重做kruskal,看新的值和原值是否一样,一样的话最小生成树不唯一。#include#include#include#include#include#include#incl...
分类:
其他好文 时间:
2015-02-06 20:27:36
阅读次数:
150
Lost Cows
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 9477
Accepted: 6110
Description
N (2 <= N <= 8,000) cows have unique brands in the range 1..N. In...
分类:
编程语言 时间:
2015-02-06 09:36:34
阅读次数:
125
题目链接:Sudoku Solver
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.
...
分类:
其他好文 时间:
2015-02-06 00:49:25
阅读次数:
155
这道题花了些时间,首先提交时runtim error,然后发现时申请数组没有释放。最后整理下题目的思路,这道题是动态规划,不过比较麻烦。想了好久才推出来,递推公式为 Cn = 2*Cn-1 + C0*Cn-2 + C1*Cn-3 ...... + Cn-2*C0。得到递推公式代码就很快了,一遍过。p...
分类:
其他好文 时间:
2015-02-05 21:46:35
阅读次数:
172
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
Elements i...
分类:
其他好文 时间:
2015-02-05 16:27:44
阅读次数:
146
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:
Element...
分类:
其他好文 时间:
2015-02-04 18:44:19
阅读次数:
127
Given an array S of n integers, are there elements a, b, c in S such that a + b + c =
0? Find all unique triplets in the array which gives the sum of zero.
Note:
Elements in a triplet (a,b,c...
分类:
其他好文 时间:
2015-02-04 14:46:28
阅读次数:
151
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:
Element...
分类:
其他好文 时间:
2015-02-04 09:34:11
阅读次数:
193
Follow up for "Unique Paths":
Now consider if some obstacles are added to the grids. How many unique paths would there be?
An obstacle and empty space is marked as 1 and 0 respectively in th...
分类:
编程语言 时间:
2015-02-04 09:28:40
阅读次数:
172
【题目】
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).
The robot can only move either down or right at any point in time. The robot is trying to...
分类:
其他好文 时间:
2015-02-03 23:00:26
阅读次数:
249