2015年4月6日
摘要: 模拟 a 反应物集合 ; b 生成物集合; c 存在的化合物或单质集合; ans 新生成化合物集合 1、如果反应无均在已生成的化合物集合中,则完成反应,将合成物加入c集合 2、对每个方程式的反应物进行排序,方便加速查找 3、不停的搜索,直到没有新化合物生成。 阅读全文
posted @ 2015-04-06 12:06 平和之心 阅读(296) 评论(0) 推荐(0) 编辑
2015年4月4日
摘要: 1、对象序列化,类实现Serializable接口 不需要序列化的属性,使用transient声明 2、使用套接字流在主机之间传递对象注意问题: 学习自:Socket同时使用ObjectInputStream和ObjectOutputStream传输序列化对象时的顺序 ObjectInputStream与ObjectOutputStream的顺序问题 在网络通讯中,主机与客户端若使用ObjectI... 阅读全文
posted @ 2015-04-04 17:13 平和之心 阅读(1013) 评论(0) 推荐(0) 编辑
摘要: 练习使用字符串函数了。 1、字串的反转也是它的字串,2、最长,3、最先出现 string: char[],用时是上面的一半 阅读全文
posted @ 2015-04-04 16:51 平和之心 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 学习自此博客题解 二分搜索+深搜。二分枚举最小差距值(路径上的最大值与最小值的差距),枚举的最小值为abs(a[1][1]-a[n][n]),最大值为题目给出的120。搜索时代入这个最小差距值,若存在一条路径满足这个最小差距值则符合条件,也就可以继续试图枚举更小的差距值。 阅读全文
posted @ 2015-04-04 10:15 平和之心 阅读(267) 评论(0) 推荐(0) 编辑
2015年4月2日
摘要: 题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=168 分析:找到一天中需要最多的房间即可 看别人题解后才明白的,同时记录下自己的模拟算法(TimeLimitExceeded) 1 #include<iostream> 2 #include 阅读全文
posted @ 2015-04-02 18:10 平和之心 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=251 规则: 1、若某竞标价唯一,则胜出 2、若不存在唯一竞标价,则投标次数最少竞标价中标,存在多个时,选择价钱最低且最先投此价钱的为中标 #include #include #include using namespace std; #define N 102 #define M 10... 阅读全文
posted @ 2015-04-02 16:54 平和之心 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=170 根据题意,需要找到度数为1的结点个数,如下图: #include #include #include #include using namespace std; #define N 10002 vector g[N]; int main() { freopen("d:\... 阅读全文
posted @ 2015-04-02 08:46 平和之心 阅读(142) 评论(0) 推荐(0) 编辑
2015年4月1日
摘要: #include #include #include #include using namespace std; #define N 352 /* 重量*单价+重量*距离 = 重量*(距离+单价) 预处理单价 贪心:优先买价格低的 */ struct Node { int p;// p = (单价+距离) int w; }c[N]; bool cmp(Node... 阅读全文
posted @ 2015-04-01 21:05 平和之心 阅读(101) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include using namespace std; #define N 1100 #define INF 0x7fffffff bool prime[N]; void init() { memset(prime, true, sizeof(prime)); pri... 阅读全文
posted @ 2015-04-01 21:04 平和之心 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=171动态规划: d(i,j) = max{d(i-1, j), d(i, j-1)}+mp[i][j]; 1 #include 2 #include 3 #include 4 #inclu... 阅读全文
posted @ 2015-04-01 21:04 平和之心 阅读(103) 评论(0) 推荐(0) 编辑