摘要: OS:Ubuntu 14.04Extract the distribution archive, i.e. apache-maven-3.2.2-bin.tar.gz to the directory you wish to install Maven 3.2.2. These instructio... 阅读全文
posted @ 2014-07-04 01:04 shaoshuai1990 阅读(342) 评论(0) 推荐(0) 编辑
摘要: Generating SSH KeysWe strongly recommend using an SSH connection when interacting with GitHub. SSH keys are a way to identify trusted computers, witho... 阅读全文
posted @ 2014-07-02 13:26 shaoshuai1990 阅读(378) 评论(0) 推荐(0) 编辑
摘要: Android开发中,在Android SDK Manager有需要更新API的时候,发现更新速度很慢,该怎么加快更新的下载速度呢?下面就介绍下如何加快更新的下载速度。方法/步骤1先看看如何加快更新速度,再说如何更新。首先更新host文件,如图,打开目录C:\Windows\System32\drivers\etc,在目录下有hosts文件打开方式选用“记事本”打开将一下的文字复制到hosts文件里面,保存,注意不修改原来的文件内容,只是附加这些内容203.208.46.146 www.google.com74.125.113.121 developer.android.com203.208. 阅读全文
posted @ 2014-03-15 14:43 shaoshuai1990 阅读(240) 评论(0) 推荐(0) 编辑
摘要: 题意:判断基因链是否匹配,匹配的双链数加1,并要标记,下次比较不能重用!解法: 打擂台法 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 bool compute(string s1, string s2){ 8 if(s1.length() != s2.length()) 9 return false;10 bool flag = false;11 for(int i=0;i strands;19 20 int main(){21 int caseN... 阅读全文
posted @ 2014-01-15 00:53 shaoshuai1990 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 题意:求输入字符串的所有组合,按字典序输出!解法:使用枚举(枚举前先找出最字符串的最小字典序)枚举时加上枚举生成条件! 1 #include 2 #include 3 #include 4 using namespace std; 5 6 bool comp(char ch1,char ch2){ 7 if(ch1 - ch2 == 32){ 8 return false; 9 }10 if (ch2 - ch1 == 32){11 return true;12 }13 if(ch1 >= 'a' && ch2 =... 阅读全文
posted @ 2014-01-14 20:38 shaoshuai1990 阅读(240) 评论(0) 推荐(0) 编辑
摘要: 题意:输入一个有向图,判断该图是否是有向无环图(Directed Acyclic Graph)。解法:还是深搜 1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 bool paths[101][101]; 8 int visited[101]; 9 bool isDAG;10 int vertices,edges;11 12 void DFS(int current){13 for(int j =1; isDAG == true && j > vertices >> edges;31 f 阅读全文
posted @ 2014-01-13 21:31 shaoshuai1990 阅读(301) 评论(0) 推荐(0) 编辑
摘要: 题意:输入一个简单(无多重边和自环)的连通无向图,判断该图是否能用黑白两种颜色对顶点染色,使得每条边的两个端点为不同颜色.解法:由于无自连通节点存在,所以只需进行一次宽搜,遍历所有的点和所有的边,判断能否用两种颜色进行染色即可!宽搜时对访问点需要进行颜色判断和标记! 1 #include 2 #include 3 #include 4 using namespace std; 5 6 int colors[1001]; 7 bool paths[1001][1001]; 8 int main(){ 9 int vertices,edges;10 int from,dest;1... 阅读全文
posted @ 2014-01-13 16:42 shaoshuai1990 阅读(247) 评论(0) 推荐(0) 编辑
摘要: 题意:求图中的连通块数,注意孤立的算自连通! 例如:6个顶点3条路径,其中路径为:1->24->51->3那么有(1-2&&1->3) + (4->5) + (6)共3个连通块!解法:对每个节点宽搜! 1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 bool roads[1001][1001]; 8 bool visited[1001]; 9 int N,M;10 11 int main(){12 13 cin >>N >>M;14 memset(r 阅读全文
posted @ 2014-01-11 22:14 shaoshuai1990 阅读(278) 评论(0) 推荐(0) 编辑
摘要: 题意:在矩阵数组中搜索两点是否可达解法:DFS 1 #include 2 #include 3 using namespace std; 4 struct position{ 5 int x; 6 int y; 7 position(int xx,int yy){ 8 x = xx; 9 y = yy;10 }11 position(){}12 };13 14 int maze[101][101];15 int canReach;16 position dest; //destination17 int row,co... 阅读全文
posted @ 2014-01-10 15:40 shaoshuai1990 阅读(290) 评论(0) 推荐(0) 编辑
摘要: 题意:求无向图路径中的最大带权值.解法:深搜 1 // Problem#: 9859 2 // Submission#: 2661875 3 // The source code is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License 4 // URI: http://creativecommons.org/licenses/by-nc-sa/3.0/ 5 // All Copyright reserved by Informatic Lab of Sun Yat- 阅读全文
posted @ 2014-01-09 23:25 shaoshuai1990 阅读(184) 评论(0) 推荐(0) 编辑