随笔分类 - STL----algorithm
摘要:N个点M条边的无向连通图,每条边有一个权值,求该图的最小生成树。 收起 N个点M条边的无向连通图,每条边有一个权值,求该图的最小生成树。 收起 N个点M条边的无向连通图,每条边有一个权值,求该图的最小生成树。 收起 N个点M条边的无向连通图,每条边有一个权值,求该图的最小生成树。 输入 第1行:2个
        阅读全文
                
摘要:There are N network nodes, labelled 1 to N. Given times, a list of travel times as directed edges times[i] = (u, v, w), where u is the source node, v 
        阅读全文
                
摘要:【问题描述】 kotori是μ's的服装设计担当。她有一个技能,是把一块布料的颜色变成另一个颜色,消耗k点魔法值。 已知一件衣服的奇异度取决于这件衣服颜色的种类。 颜色种类为1时,奇异度为1。 颜色种类为2时,奇异度为3。 颜色种类不小于3时,奇异度为10。 一件衣服由很多块布料编织而成。kotor
        阅读全文
                
摘要:Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) Yo
        阅读全文
                
摘要:Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and r
        阅读全文
                
摘要:Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum pro
        阅读全文
                
摘要:Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the fo
        阅读全文
                
摘要:Given an integer array nums, find the contiguous subarray within an array (containing at least one number) which has the largest product. Example 1: E
        阅读全文
                
摘要:Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area. Example: 这是一个DP题,好像是线性DP吧。 官方题解有DP的
        阅读全文
                
摘要:Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. 
        阅读全文
                
摘要:In a row of dominoes, A[i] and B[i] represent the top and bottom halves of the i-th domino. (A domino is a tile with two numbers from 1 to 6 - one on 
        阅读全文
                
摘要:There are a number of spherical balloons spread in two-dimensional space. For each balloon, provided input is the start and end coordinates of the hor
        阅读全文
                
摘要:Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]). Y
        阅读全文
                
摘要:题目描述: 家住非洲的小孩,都很黑。为什么呢?第一,他们地处热带,太阳辐射严重。第二,他们不经常洗澡。(常年缺水,怎么洗澡。)现在,在一个非洲部落里,他们只有一个地方洗澡,并且,洗澡时间很短,瞬间有木有!!(这也是没有的办法,缺水啊!!)每个小孩有一个时间段能够洗澡。并且,他们是可以一起洗的(不管你
        阅读全文
                
摘要:X轴上有N条线段,每条线段包括1个起点和终点。线段的重叠是这样来算的,[10 20]和[12 25]的重叠部分为[12 20]。 给出N条线段的起点和终点,从中选出2条线段,这两条线段的重叠部分是最长的。输出这个最长的距离。如果没有重叠,输出0。 输入 第1行:线段的数量N(2 <= N <= 50
        阅读全文
                
摘要:题目背景 A地区在地震过后,连接所有村庄的公路都造成了损坏而无法通车。政府派人修复这些公路。 题目描述 给出A地区的村庄数N,和公路数M,公路是双向的。并告诉你每条公路的连着哪两个村庄,并告诉你什么时候能修完这条公路。问最早什么时候任意两个村庄能够通车,即最早什么时候任意两条村庄都存在至少一条修复完
        阅读全文
                
摘要:题目描述 Description 学校需要将n台计算机连接起来,不同的2台计算机之间的连接费用可能是不同的。为了节省费用,我们考虑采用间接数据传输结束,就是一台计算机可以间接地通过其他计算机实现和另外一台计算机连接。 为了使得任意两台计算机之间都是连通的(不管是直接还是间接的),需要在若干台计算机之
        阅读全文
                
摘要:题目描述 Description 给定x轴上的N(0<N<100)条线段,每个线段由它的二个端点a_I和b_I确定,I=1,2,……N.这些坐标都是区间(-999,999)的整数。有些线段之间会相互交叠或覆盖。请你编写一个程序,从给出的线段中去掉尽量少的线段,使得剩下的线段两两之间没有内部公共点。所
        阅读全文
                
摘要:成绩统计 Time Limit(Common/Java):1000MS/3000MS Memory Limit:65536KByteTotal Submit:88 Accepted:22 Description 期末考试结束了,在所有的成绩出来以后,老师对着一堆数据发愁了,因为学校要求老师找出这些成
        阅读全文
                
摘要:1264 线段相交 1264 线段相交 1264 线段相交 给出平面上两条线段的两个端点,判断这两条线段是否相交(有一个公共点或有部分重合认为相交)。 如果相交,输出"Yes",否则输出"No"。 给出平面上两条线段的两个端点,判断这两条线段是否相交(有一个公共点或有部分重合认为相交)。 如果相交,
        阅读全文
                

浙公网安备 33010602011771号