前篇博客LZ已经分析了ReentrantLock的lock()实现过程,我们了解到lock实现机制有公平锁和非公平锁,两者的主要区别在于公平锁要按照CLH队列等待获取锁,而非公平锁无视CLH队列直接获取锁.但是对于unlock()而已,它是不分为公平锁和非公平锁的. public void unlock() { sync.release(1); } public final boolean release(int arg) { if (tryRelease(arg)) { Node h = he
A Bit Fun Time Limit: 5000/2500 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1148 Accepted Submission(s): 644 Problem Description There are n numbers in a array, as a0, a1 ... , an-1, and another number m. We d
题目传送门 题意:从n个数中选出不同的三个数a b c,使得(a+b)^c 最大 分析:先将所有数字按位插入到字典树上,然后删除两个数字,贪心询问与剩下的数字最大异或值. /************************************************ * Author :Running_Time * Created Time :2015/11/1 14:58:49 * File Name :J.cpp *************************************
J. FatMouse's Speed FatMouse believes that the fatter a mouse is, the faster it runs. To disprove this, you want to take the data on a collection of mice and put as large a subset of this data as possible into a sequence so that the weights are incre
package com.test.forname; public class TestForName { public static void main(String[] args) throws Exception{ /* A a = (A) Class.forName("com.test.a.A").newInstance(); Class<?> c = Class.forName("com.test.c.C"); System.out.printl
com.mysql.jdbc.CommunicationsException: The last packet successfully received from the server was58129 seconds ago.The last packet sent successfully to the server was 58129 seconds ago, which is longer than the server configured value of 'wait_timeou