一、线程的同步和互斥 同步是指散步在不同任务之间的若干程序片断,它们的运行必须严格按照规定的某种先后次序来运行,这种先后次序依赖于要完成的特定的任务。最基本的场景就是:两个或两个以上的进程或线程在运行过程中协同步调,按预定的先后次序运行。比如 A 任务的运行依赖于 B 任务产生的数据。 互斥是指散步 ...
分类:
编程语言 时间:
2019-05-13 00:55:18
阅读次数:
179
首先把点权归到边上,设点权较小的一个点是v,也就是(u,v)的边权是log2(dis(u,v)) a[v]+a[v]+a[u] 然后还有一个性质就是这棵树按点权最小点提起来就是一个堆 暴力是n^2的MST,然后考虑优化,按照点权从小到大加入生成树,那么每个点加进去的时候会连到点权比他小的点上 因为l ...
分类:
其他好文 时间:
2019-05-11 18:20:59
阅读次数:
111
Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff pair is defined as an inte ...
分类:
其他好文 时间:
2019-05-11 09:41:02
阅读次数:
132
{ 单元名:跨平台的TCP客户端库封装 作者:5bug 网站:http://www.5bug.wang } unit uCPTcpClient; interface uses System.Classes, System.SysUtils, IdTCPClient, IdGlobal; type T... ...
实现环境表结构:models.py表单创建与代码fromdjango.dbimportmodels#Createyourmodelshere.classPublisher(models.Model):id=models.AutoField(primary_key=True)name=models.CharField(max_length=64,null=False,unique=True)def_
分类:
其他好文 时间:
2019-05-10 11:08:05
阅读次数:
123
Mysql五大约束 约束:对表中数据的限制、保证表中数据的准确和可靠 (1)NOT NULL:非空,用于保证该字段的值不能为空 (2)DEFAULT:默认,用于保证该字段有默认值(3)PRIMARY KEY:主键,用于保证该字段的值具有唯一性,并且非空(4)UNIQUE:唯一,用于保证该字段的值具有 ...
分类:
数据库 时间:
2019-05-06 20:49:02
阅读次数:
361
https://leetcode.com/problems/unique-binary-search-trees/ Given n, how many structurally unique BST's (binary search trees) that store values 1 ... n? ...
分类:
其他好文 时间:
2019-05-06 19:00:05
阅读次数:
117
A: Unique Paths II Medium 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 eit ...
分类:
其他好文 时间:
2019-05-05 23:40:11
阅读次数:
184
Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the ...
分类:
编程语言 时间:
2019-05-05 14:41:47
阅读次数:
164