目录
选择题
1.
数据库服务器一定要保证数据的可靠性,而 UDP 是不可靠的。
2.
3.
排它锁:只能获取排它锁的事务自己操作,其他事务不能读也不能写。
4.
alter 就是用来操作表属性的。
编程题
1.扑克牌大小
题目给了提示,按提示写即可。
代码实现:
import java.util.Scanner;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
// 注意 hasNext 和 hasNextLine 的区别
while (in.hasNextLine()) { // 注意 while 处理多个 case
String str = in.nextLine();
// 将两组牌分开
String[] cards = str.split("-");
String[] card1 = cards[0].split(" ");
String[] card2 = cards[1].split(" ");
String order = "34567891JQKA2";
// 先判断对王
if (cards[0].equals("joker JOKER") || cards[1].equals("joker JOKER")) {
System.out.println("joker JOKER");
} else if (card1.length == card2.length) {
// 比较第一张牌大小即可。
if (order.indexOf(card1[0].substring(0,1))
> order.indexOf(card2[0].substring(0, 1))) {
System.out.println(cards[0]);
} else {
System.out.println(cards[1]);
}
} else if (card1.length == 4) {
// 如果是炸弹
System.out.println(cards[0]);
} else if (card2.length == 4) {
System.out.println(cards[1]);
} else {
System.out.println("ERROR");
}
}
}
}