上一页 1 2 3 4 5 6 7 8 ··· 28 下一页
摘要: 题目代码如下: a.控制流图如下: b.设计一个t2=(n=5)比t1=(n=3)更容易发现的错误。容易想到数组越界,即当 MAXPRIMES = 3 or 4 时,t1正常通过,而t2会因越界而报错。 c.显然当 n = 1 时不会经过while循环。 d.找出所有点覆盖、边覆盖和主路径覆盖的TR 阅读全文
posted @ 2016-03-30 20:47 hxy_has_been_used 阅读(242) 评论(0) 推荐(0) 编辑
摘要: 一、简介 JUnit是一个Java语言的单元测试框架。它由Kent Beck和Erich Gamma建立,逐渐成为源于Kent Beck的sUnit的xUnit家族中最为成功的一个。 JUnit有它自己的JUnit扩展生态圈。多数Java的开发环境都已经集成了JUnit作为单元测试的工具。 二、环境 阅读全文
posted @ 2016-03-18 20:04 hxy_has_been_used 阅读(280) 评论(0) 推荐(0) 编辑
摘要: 一、 1 public int findLast (int[] x, int y) 2 { 3 //Effects: If x==null throw NullPointerException 4 // else return the index of the last element 5 // i 阅读全文
posted @ 2016-03-10 22:32 hxy_has_been_used 阅读(239) 评论(0) 推荐(0) 编辑
摘要: 项目名称:数独游戏 目标:一个有不同难度类型、可以随机生成不同关卡且具有提示的java版数独游戏 计划的开始截止日期:2015.9.1 ~ 2015.9.21 实际的开始截止日期:2015.9.9 ~ 2015.9.21 tools:java swing api以及博客园和知乎上讨论的数独算法实现 阅读全文
posted @ 2016-03-07 16:36 hxy_has_been_used 阅读(230) 评论(0) 推荐(0) 编辑
摘要: 由于C++语言的高效性与便利性,在进行一些算法设计的时候我总是会选择用C++。其中我遇到过的一个错误让我印象深刻。这是一个关于线段树和运算符优先级的故事。 基本的递归式的线段树看起来大致像这样: #include <iostream> #include <cstring> #include <cst 阅读全文
posted @ 2016-03-07 16:11 hxy_has_been_used 阅读(968) 评论(1) 推荐(0) 编辑
摘要: 问题可以抽象为求起点到终点的最短路,其中经过x的代价是0,而经过.的代价是1,bfs的时候用优先队列即可。 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 const int N = 1001; ... 阅读全文
posted @ 2015-10-06 09:56 hxy_has_been_used 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 思路:将所有‘1’的点入队bfs一次即可。 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 typedef pair pii; 8 const int N = 183; 9 char g[N][N... 阅读全文
posted @ 2015-10-05 14:27 hxy_has_been_used 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 很容易想到离线处理:将边按权值从小到大排序,将询问从小到大排序,然后对于某个询问,边权值不超过该次询问的边都加上,用并查集来维护答案。 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 const ... 阅读全文
posted @ 2015-10-04 13:48 hxy_has_been_used 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 问题可以简化为求最长路,因为边权均为正,所以有环即意味着最长路是正无穷必定有解;而无环的情况可以以每个点为起点进行dfs求出以该点为起点的最长路如果不小于s即有解。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 con... 阅读全文
posted @ 2015-10-04 12:42 hxy_has_been_used 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 想了想树套树比较难写,于是块链试一下,2秒左右过了。 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 8 typedef long long ll; 9 co... 阅读全文
posted @ 2015-10-01 20:58 hxy_has_been_used 阅读(186) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 28 下一页