- 博客(92)
- 收藏
- 关注
原创 悲观锁及乐观锁
一、三种典型不一致: 假设数据A=1 1.脏读: -> T1读取A=1 -> T1修改写入A=2 -> T2读取A=2 -> T1rollback,即A=1 T2读取的数据是错误的2.丢失修改 -> T1读取A=1 -> T2读取A=1 -> T1修改A=A+1=2 -> T2修改A=A+1=2 -> T1写A=2 ...
2018-04-15 21:55:55
237
转载 设计模式
1.工厂模式public interface Shape { void draw();}public class Rectangle implements Shape { @Override public void draw() { System.out.println("Inside Rectangle::draw() method."); ...
2018-04-14 22:06:26
194
原创 HashMap
所有图片图片来源 0.总体:冲突处理采用的是分离链接法(还有一种是开放地址法) 1.继承的类和实现接口public class HashMap<K,V> extends AbstractMap<K,V> implements Map<K,V>, Cloneable, Serializable2.属性Node<K,V>...
2018-04-14 15:38:31
178
原创 ArrayList和LinkedList
一、ArrayList 1.继承的类和实现的接口public class ArrayList<E> extends AbstractList<E> implements List<E>, RandomAccess, Cloneable, java.io.Serializable2.get(int indx)方法:取得下标index处...
2018-04-14 09:31:01
178
转载 1043
A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with keys less than the node's key.The right subtre
2018-04-13 14:02:19
291
原创 1042
piccolo 同一题目5秒内只能提交1次 1042. Shuffling Machine (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, YueShuffling is a procedure used to randomize a deck of playing cards. Bec
2018-04-12 12:55:13
378
原创 1041
Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen from [1, 104]. The first one who bets on a
2018-04-12 11:52:13
262
原创 1040(!)
Given a string, you are supposed to output the length of the longest symmetric sub-string. For example, given “Is PAT&TAP symmetric?”, the longest symmetric sub-string is “s PAT&TAP s”, hence you must
2018-04-11 12:28:22
161
原创 SQL语言
创建/删除 数据库create/drop database databasebname创建/删除 视图create/drop view viewname (c1,c2...) as select c1,c2... from tablename where...创建表create table tablename (c1 int(10) not null primary keyc2 ...
2018-04-10 22:37:32
148
原创 hibernate创建数据库表时的 'type=MyISAM' 错误
原因:老版本mysql使用type=MyISAM,mysql5.1以后使用engine=MyISAM解决方法: 将配置文件<propertyname="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>改为<propertyname="hibernate.dialect">org.hibernate.dialect
2018-04-10 21:44:27
1917
原创 1039
Zhejiang University has 40000 students and provides 2500 courses. Now given the student name lists of all the courses, you are supposed to output the registered course list for each student who comes ...
2018-04-10 13:00:38
200
原创 1038
Given a collection of number segments, you are supposed to recover the smallest number from them. For example, given {32, 321, 3214, 0229, 87}, we can recover many numbers such like 32-321-3214-0229-87
2018-04-09 15:38:52
244
原创 1037
The magic shop in Mars is offering some magic coupons. Each coupon has an integer N printed on it, meaning that when you use this coupon with a product, you may get N times the value of that product ba
2018-04-09 14:55:07
258
原创 1036
This time you are asked to tell the difference between the lowest grade of all the male students and the highest grade of all the female students.Input Specification:Each input file contains one test c
2018-04-08 15:51:31
124
原创 1035
To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords since it is hard to distinguish 1 (one) from l (L i
2018-04-08 15:19:01
529
原创 1034
One way that the police finds the head of a gang is to check people’s phone calls. If there is a phone call between A and B, we say that A and B is related. The weight of a relation is defined to be th
2018-04-06 15:09:36
323
转载 1033
With highways available, driving a car from Hangzhou to any other city is easy. But since the tank capacity of a car is limited, we have to find gas stations on the way from time to time. Different gas
2018-04-05 15:55:35
170
转载 学习学习
servlet工作原理 java servlet技术简介 Tomcat系统架构 设计模式 servlet、jsp web.xml spring代理模式及AOP java连接池 TCP/IP三次握手四次挥手 hibernate作用 struts2作用...
2018-04-05 11:09:30
125
原创 1032
To store English words, one method is to use linked lists and store a word letter by letter. To save some space, we may let the words share the same sublist if they share the same suffix. For example,
2018-04-03 15:52:08
148
原创 1031
Given any string of N (>=5) characters, you are asked to form the characters into the shape of U. For example, “helloworld” can be printed as:h d e l l r lowoThat is, the characters must be print
2018-04-03 14:49:37
155
原创 response
一秒刷新页面一次 response.setHeader("refresh","1"); 二秒跳到其他页面 response.setHeader("refresh","2;URL=otherPagename");没有缓存:response.setHeader("Pragma", "No-cache"); response.setHeader("Cache-Control", "no-cache"
2018-04-02 17:53:09
141
原创 1030
A traveler’s map gives the distances between cities along the highways, together with the cost of each highway. Now you are supposed to write a program to help a traveler to decide the shortest path be
2018-04-02 16:24:41
126
原创 1029
Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median of S1={11, 12, 13, 14} is 12, and the median of S2={9, 10, 15, 16, 17} is 15. The
2018-04-02 15:01:13
120
原创 1028
Excel can sort records according to any column. Now you are supposed to imitate this function.InputEach input file contains one test case. For each case, the first line contains two integers N (<=10000
2018-03-31 15:56:10
201
原创 1027
People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is represented by a 6-digit number, where the first 2 digits are for Red, the middle 2 digi
2018-03-31 14:58:53
272
原创 1025
Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneously in several places, and the ranklists wi
2018-03-29 16:20:25
536
原创 equals 和 ==
java中的数据类型,可分为两类: 1.基本数据类型,也称原始数据类型。byte,short,char,int,long,float,double,boolean 他们之间的比较,应用双等号(==),比较的是他们的值。 2.复合数据类型(类) 当他们用(==)进行比较的时候,比较的是他们在内存中的存放地址,所以,除非是同一个new出来的对象,他们的比较后的结果为true,否则比较后结
2018-03-29 09:06:43
124
原创 1024
A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number. All single digit numbers are palindromic numbers.
2018-03-27 17:15:21
9391
原创 1023
Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 246913578, which happens to be another 9-digit number cons
2018-03-27 16:04:05
224
转载 1022
A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years. Each book is assigned an unique 7-digit number a...
2018-03-26 15:56:25
245
转载 c++getline()、get()等
此文转自在学习C++的过程中,经常会遇到输入输出的问题,以下总结一下下面几个函数的用法: 1)、cin 2)、cin.get() 3)、cin.getline() 4)、getline() 5)、gets()1、cin>> 用法1:最基本,也是最常用的用法,输入一个数字: #include <iostream> using namespace std; main (
2018-03-26 15:09:25
39516
10
原创 备战1
递归:结束条件+子递归多项式直接暴力数组,index为指数,值为系数输入时尽量把要输出的信息都采集到而结构体中(时间、排名…)时间用int表示(秒),计算设置相对0起点结构体定义struct xx{…} s[1000];直接初始化了结构体数组string比较用strcmp()<0 (#include ...
2018-03-24 19:47:00
147
原创 1021
A graph which is connected and acyclic can be considered a tree. The height of the tree depends on the selected root. Now you are supposed to find the root that results in a highest tree. Such a root i
2018-03-24 16:43:00
199
转载 (普通)二叉树知前中序求后序,后中序求前序,(二叉搜索树的)前序求后序
来自柳婼 输出层序的话可以用数组每层遍历存储,参考PAT甲级1020已知后序中序输出前序#include <iostream>using namespace std;int post[] = {3, 4, 2, 6, 5, 1};int in[] = {3, 2, 4, 1, 6, 5};void pre(int root, int start, int end)...
2018-03-23 21:20:43
183
转载 1020
Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to output the level order traversal sequence of the corr
2018-03-23 21:03:53
202
原创 1019
A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number. All single digit numbers are palindromic numbers.
2018-03-23 19:19:23
171
原创 1018
There is a public bike service in Hangzhou City which provides great convenience to the tourists from all over the world. One may rent a bike at any station and return it to any other stations in the c
2018-03-22 21:13:06
194
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人