
九度经典题目
文章平均质量分 69
cjweffort
机器学习,大数据,开源,c
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
题目1482:玛雅人的密码
题目描述: 玛雅人有一种密码,如果字符串中出现连续的2012四个数字就能解开密码。给一个长度为N的字符串,(2= 题意要求通过移位使得出现连续的2012四个数字,搜索题,只是搜索状态不好发现,总共的所搜状态顶多3^13=1594323,开辟hash[1594323];所以使用搜索不会超时。 关键在于“当前状态字符串“转换成相应的状态hash值,从而可以具体实施搜索。原创 2013-03-09 23:33:24 · 1857 阅读 · 0 评论 -
题目1462:两船载物问题
题目描述: 给定n个物品的重量和两艘载重量分别为c1和c2的船,问能否用这两艘船装下所有的物品。 刚开始还以为可以搞贪心,脑子短路了,后来想想,都使劲往一个背包塞可以搞成01背包问题。。ok 具体的要先往哪个背包塞还有待考量...... 程序代码如下: #include #include #define max(a,b) a>b?a:b const in原创 2013-03-09 23:19:08 · 850 阅读 · 0 评论 -
题目1481:Is It A Tree?
A tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by directed edges between nodes satisfying the following properties. Ther原创 2013-03-09 23:56:42 · 828 阅读 · 0 评论 -
题目1491:求1和2的个数
题目描述: 给定正整数N,函数F(N)表示小于等于N的自然数中1和2的个数之和,例如:1,2,3,4,5,6,7,8,9,10序列中1和2的个数之和为3,因此F(10)=3。输入N,求F(N)的值,1= 题意要求找出1-N之间的数中1和2出现的次数,只要找出1出现的次数,2同理可得。 参考《编程之美》上1的数目,该题需要找规律,又是规律题,清华的机试给跪了~~~ 总结规律如下:N=ab原创 2013-03-09 22:40:50 · 2649 阅读 · 0 评论 -
题目1347:孤岛连通工程
http://ac.jobdu.com/problem.php?pid=1347 用getchar读取数据居然可以少这么多,比起scanf整整少了320ms 并查集优化: (1)路径压缩 我们找到最久远的祖先时“顺便”把它的子孙直接连接到它上面 int findSet(int x){ if(fa[x]==-1) return x; int ret=findSet(fa[x])原创 2013-03-14 18:42:30 · 556 阅读 · 0 评论 -
题目1494:Dota
学习完全背包 // 题目1494:Dota.cpp: 主项目文件。 #include "stdafx.h" #include #include #define max(a,b) a>b?a:b const int N=203; int value[N],volumn[N]; const int M=1003; int dp[M]; int main() { int n,m,to原创 2013-03-24 23:02:46 · 587 阅读 · 0 评论