多线程编程一直是老生常谈的问题,在Java中,随着JDK的逐渐发展,JDK提供给我们的并发模型也越来越多,本文摘取三例使用不同原理的模型,分析其大致原理。目录如下: 1.COW之CopyOnWriteArrayList 2.CAS之ConcurrentHashMap 3.读写分离之LinkedBlo ...
分类:
编程语言 时间:
2018-02-02 00:38:45
阅读次数:
225
先满足挑剔的 cpp include include include include using namespace std; typedef long long ll; int n, m, tmp, rot, cnt; ll ans; struct Cow{ int pri, gre; }cow[ ...
分类:
其他好文 时间:
2018-01-30 12:44:40
阅读次数:
154
"题目链接" 题目描述 对于一个给定的字符串,可以从左右两端取字符,依次排列构成一个新的字符串。 求可能构成的字符串中字典序 最小的一个。 例:ACDBCB ABCBCD 思路 参考自 "xueyifan1993" . 正确的 贪心 姿势: 记左端位置为 $l$,右端位置为 $r$,比较 $suff ...
分类:
编程语言 时间:
2018-01-28 00:09:42
阅读次数:
197
public String getHint(String secret, String guess) { /* 判断bull 是通过比较两个字符串的每一位,每次相同就删除该字符出现的次数,因为后边的 要判断cow不能占用这些 判断cow只要检测出去被占用的还有没有该字符 */ //key记录字符,v ...
分类:
其他好文 时间:
2018-01-21 12:37:14
阅读次数:
158
[BZOJ 3048][Luogu P3069][USACO2013 Jan]Cow Lineup <题意概括> 给定$n\left(n\leqslant100000\right)$个数,求删掉k种相同的数之后最长的相同数区间长度 <做法> 典型的双指针题目 由于数据范围较大,我们将数据离散化 使用 ...
分类:
其他好文 时间:
2018-01-12 11:32:57
阅读次数:
139
在使用kvm虚拟机的时候,有时候部署一些应用如OracleRAC、corosync等高可用的时候,往往会用到共享硬盘。比如本人在部署corosync+mysql高可用的时候就遇到了一些小问题(*像我们这种折腾达人,肯定不会用nfs做共享存储*),因此记录一下。环境:宿主机当然是linux,否则也用不到kvm没有图形界面,否则直接virt-manager也很快。。操作过程新建一块虚拟盘root@qu
分类:
其他好文 时间:
2018-01-09 17:31:53
阅读次数:
226
Catch That Cow Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 102339 Accepted: 31988 Description Farmer John has been informed of the loca ...
分类:
其他好文 时间:
2018-01-07 15:53:31
阅读次数:
149
P1821 [USACO07FEB]银牛派对Silver Cow Party 题目描述 One cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big cow part ...
分类:
其他好文 时间:
2018-01-06 16:01:03
阅读次数:
166
POJ - 2230 Watchcow Watchcow Bessie's been appointed the new watch-cow for the farm. Every night, it's her job to walk across the farm and make sure t ...
分类:
其他好文 时间:
2018-01-01 16:54:16
阅读次数:
192
P3662 [USACO17FEB]Why Did the Cow Cross the Road II S P3662 [USACO17FEB]Why Did the Cow Cross the Road II S P3662 [USACO17FEB]Why Did the Cow Cross th ...
分类:
其他好文 时间:
2017-12-31 11:57:53
阅读次数:
173