- 博客(10)
- 资源 (1)
- 收藏
- 关注
原创 vbox下虚拟机同宿主机互相ping,且虚拟机能访问网络的配置
https://blog.csdn.net/yongchurui/article/details/46448231遇到的问题:创建不成功解决方案:在虚拟机中,可能原本只有一个网卡,需要新增一个网卡编辑/etc/network/interface 新增网卡然后运行下面这个命令让网卡启动sudo ifup 网卡名...
2018-04-25 20:31:49 192
转载 Java解析XML的方法总结
转载自:http://freewxy.iteye.com/blog/981000四种XML解析方法: (1)Dom生成和解析XML文档 *解析器读入整个文档,然后构建一个驻留内存的树结构,然后代码就可以使用 DOM 接口来操作这个树结构。 * 优点:整个文档树在内存中,便于操作;支持删除、修改、重新排列等多种功能; * 缺点:将整个文档调
2016-07-14 18:10:01 217
原创 1043. Is It a Binary Search Tree (25)
#include#include// 6// 5 7// 6// 6using namespace std;struct Node{ Node* left; Node* right; int value;};int a[1001];int N;Node* createTree(int first,int last
2016-04-27 20:05:44 190
转载 1039. Course List for Student (25)
这道题的基本思路就是采用倒排索引来建立 学生->所选课程 的关系开始做的时候,直接使用map > course;结果就是超时.原因就是使用string而不是char*.因此考虑为学生姓名建立一个索引学生姓名->姓名索引->课程集合#include#include#include#include#includeusing namespace std;map > cour
2016-04-23 21:11:08 205
原创 1038. Recover the Smallest Number (30)
这道题目的主要问题就在与如何比较两个数拼接的顺序,我采取的方式是使用分别将两种拼接方式做一个比较,这样就可以得到两个数的拼接顺序.对所有数按照上述做法做一个排序,就可以得到所有数的顺序.接下来就是如何处理数前面的0的问题.这道题还有一个坑就是如果全为0,就要输出'0'.#include#include#includeusing namespace std;vector num;bo
2016-04-23 20:28:00 218
原创 1034. Head of a Gang (30)
#include#include#include#include#includeusing namespace std;typedef struct { int id; int total;}Node;typedef struct { string head; int cnt;}Answer;map nameid;//name->idm
2016-04-21 21:41:28 218
原创 1022. Digital Library (30)
这段题目采用了倒排索引的思路,为每一个需要查找的关键字建立一个map,其中的值存放的是书的ID。因为关键字分为5种,所以建立了map数组。同时一个关键字所对应的书的ID可能有多个,所以使用vector来存储ID。#include#include#include#include#include#includeusing namespace std;map > bookmap[6
2016-03-31 19:20:09 218
原创 1003. Emergency (25)
As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some roads. Amount of rescue teams in each city and the l
2016-03-21 21:35:04 399
原创 1001. A+B Format (20)
Calculate a + b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four digits).InputEach input file cont
2016-03-15 20:50:37 166
原创 关机static{}语句块的执行问题详解
1.什么时候需要使用static{}一般情况下,如果有些代码必须在项目启动的时候就执行的时候,需要使用静态代码块,这种代码是主动执行的2.static{}在什么时候被执行?static{}是在类加载的时候被执行的,因为在虚拟机的生命周期中一个类只被加载一次;又因为static{}是伴随类加载执行的,所以,不管你new多少次对象实例,static{}都只执行一次。
2015-09-22 21:45:34 209
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人