next()方法以空格与回车为结束符
nextLine()方法只以回车为结束符
charAt(int)方法返回下标处的单个字符
toUpperCase() toLowerCase()方法把string全部转换为大小写
hasNext()函数用于多组输入
Map<Integer, Integer> mp = new HashMap<Integer, Integer>();定义map键值对
map.containsKey(key)查询map中是否有key键值
map.get(key),foreach循环可以快速遍历set
String.split(Str)方法可以对String进行分割 分割符为str,返回值为字符串数组
str.compareTo()方法可以比较两个字符串的字典序正序输出负数相等返回0逆序返回一个正数
String str = new String(char[])可以将char数组转化为String类型
Arrays.sort()排序函数
Queue<Integer> que = new LinkedList<Integer>();
PriorityQueue<Integer> que = new PriorityQueue<Integer>();优先队列声明方式
public static Comparator<Integer> Cmp = new Comparator<Integer>(){
public int compare(Integer a, Integer b){
return (int)(b - a);
}
};比较器Comparator,用于优先队列排序方法等自定义排序规则
ArrayList<Edge>[] Ed = new ArrayList[50];邻接链表
File file = new File("nmd.txt");
Scanner cin = new Scanner(file);
PrintWriter writer = new PrintWriter(file);
/*FileWriter fw = new FileWriter(file2, true);
PrintWriter writer = new PrintWriter(fw);*/可以在file2文件的基础上追加写内容