上一页 1 ··· 4 5 6 7 8 9 10 11 12 13 下一页
摘要: Dashboard - Practice Round China New Grad Test 2014 - Google Code JamSourceURL:https://code.google.com/codejam/contest/2933486/dashboard#s=p2 Practice Round China New Grad Test 2014 A. Bad Hor... 阅读全文
posted @ 2014-04-12 17:05 周卓 阅读(822) 评论(0) 推荐(0) 编辑
摘要: Problem A Read Phone Number Do you know how to read the phone numbers in English? Now let me tell you. For example, In China, the phone numbers are 11 digits, like: 15012233444. Someone divides the numbers into 3-4-4 format, i.e. 150 1223 3444. While someone divides the numbers into 3-3-5 format, i. 阅读全文
posted @ 2014-04-12 11:11 周卓 阅读(520) 评论(0) 推荐(0) 编辑
摘要: 题目1 : Arithmetic Expression 描述Given N arithmetic expressions, can you tell whose result is closest to 9? 输入Line 1: N (1 c/d a*d > b*c.因此我们将所有的数都表示成 abs(divided/divisor -9) 的形式. 比如 901 / 100 -> 1/100; 3*3 -> 0/1; 2+6 -> 1/1; 8 - -1 = 0/1;这样就不会有小数的问题了.#include #include #include #include #i 阅读全文
posted @ 2014-04-12 10:11 周卓 阅读(251) 评论(0) 推荐(0) 编辑
摘要: 1. pcap_t* pcap_open_offline(const char* fname, char* errbuf) Open a savefile in the tcpdump/libpcap format to read packets. pcap_open_offline()is cal... 阅读全文
posted @ 2014-04-10 22:30 周卓 阅读(680) 评论(0) 推荐(0) 编辑
摘要: 1. Boost.Filesystem file_size function returns a uintmax_t containing the size of the file named by the argument. The declaration looks like this:uintmax_t file_size(const path& p); 2. For now, all you have to know is that class path has constructors that take const char* and many other useful t 阅读全文
posted @ 2014-04-10 14:00 周卓 阅读(211) 评论(0) 推荐(0) 编辑
摘要: 总结1. 坐标的确定2. 有了坐标公式, 下一步就好做了使用 DFS 查找 left hand, right hand 最短路. BFS 全局最短路 阅读全文
posted @ 2014-04-08 17:06 周卓 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 这里给出了 Bellmanford 和 SPFA 的算法思想和伪代码, 但这离具体的实现还有差距, 最短路径算法的使用频率很高, 有必要总结一下1. SPFA 算法算法的核心是: 松弛有效的操作必然发生在松弛前导节点成功松弛的节点上/* * spfa.h * * Created on: Apr 8... 阅读全文
posted @ 2014-04-08 15:39 周卓 阅读(256) 评论(0) 推荐(0) 编辑
摘要: 总结1. 这里 dp[][][] 不是恰好走 k 步, 而是最多走 k 步. 恰好和最多的区别就在于 dp 数组的初始化上了代码/* * source.cpp * * Created on: Apr 7, 2014 * Author: sangs */#include #include #include #include #include #include #include using namespace std;int val[1000];int dp[500][500][2];vector graph[1000];/* * dp[u][t][0] start from u an... 阅读全文
posted @ 2014-04-08 14:42 周卓 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 总结1. dp[u][k] 是恰好用完 k 时间的最大价值2. dfs(u, pre, vmax) 是计算 dp[u][1...vmax] 的值3. dfs 内部遍历, j 从大到小, 防止重复计算 f(j) = g(j-k)而 k 是从小到大, 因为在 134 行, dp[j] = max(dp[j], dp[j-k]+dp'[k]) 比较特殊, k 可以等于 0. 导致 dp[j] 被重复计算代码/* * source.cpp * * Created on: Apr 6, 2014 * Author: sangs */#include #include #include #in.. 阅读全文
posted @ 2014-04-08 11:55 周卓 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 题目描述总结1. 这种状态转移的题目不太好 debug, 写起来总觉得不对劲2. 动规的初始化总能找到一些简练的初始化方法, 比如这道题, 可以选择 j>=0, dp[0] = 1, 或者对 vector 中的所有元素赋值 dp[s] = 1, 然后 j > 0代码 TLE 了/* * source.cpp * * Created on: Apr 6, 2014 * Author: sangs */#include #include #include #include #include #include #include using namespace std;int arr[10 阅读全文
posted @ 2014-04-06 23:10 周卓 阅读(173) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 13 下一页