- 博客(30)
- 资源 (1)
- 问答 (1)
- 收藏
- 关注
转载 动态内存分配与释放(new and delete)
Cpp Operators of new and delete1.动态内存分配与释放(new and delete)
2014-07-31 10:49:04 783
原创 POJ 1056 IMMEDIATE DECODABILITY 字典树
样例 POJ 1056 http://poj.org/problem?id=1056字典树入门,很容易的一道字典树题;题意: 输入一些字符串,由0 1 组成,如果有一个字符串是另一个的前缀,就是不能被立即解开的锁,输出Set 1 is not immediately decodable,如果没有前缀,就是能被立即解开的,输入一个 9 代表 这组输入结束,每组结束后,需要对
2014-07-31 10:43:22 582
原创 HDU 1239 Calling Extraterrestrial Intelligence Again(找素数)
http://acm.hdu.edu.cn/showproblem.php?pid=1239题目
2014-07-30 15:27:41 563
原创 HDU 2101 A计划
点击打开链接http://acm.hdu.edu.cn/showproblem.php?pid=2102AC代码 三维数组
2014-07-29 11:35:29 419
原创 hdu 1175 连连看
连连看Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 17604 Accepted Submission(s): 4571Problem Description“连连看”相信很多人都玩过。没玩过也没关系,下
2014-07-25 10:33:45 696
原创 POJ 1321 棋盘问题
http://poj.org/problem?id=1321棋盘问题Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 22332 Accepted: 11084Description在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别
2014-07-24 09:29:14 478
原创 HDU 1010 Tempter of the Bone(DFS+剪枝)
关于剪枝,没有剪枝的搜索不太可能,这题老刘上课的时候讲过两个剪枝,一个是奇偶剪枝,一个是路径剪枝奇偶剪枝:把矩阵标记成如下形式:0,1,0,1,01,0,1,0,10,1,0,1,01,0,1,0,1很明显,如果起点在0 而终点在1 那显然 要经过奇数步才能从起点走到终点,依次类推,奇偶相同的偶数步,奇偶不同的奇数步在读入数据的时候就可以判断,并且做剪枝,当然做的时候并不要求把整个矩阵0,1刷
2014-07-23 18:46:52 425
原创 函数 qsort 和 bsearch 的用法(poj2503)
c函数qsort()和bsearch()的用法使用qsort()排序 并 用 bsearch()搜索是一个比较常用的组合,使用方便快捷。qsort 的函数原型是void __cdecl qsort ( void *base, size_t num, size_t width, int (__cdecl *comp)(const void *, const void* ) )其中base是排
2014-07-21 11:07:04 574
原创 斐波那契的矩阵快速幂
斐波那契数列为例 an=an-1+an-2我们的目的是通过矩阵乘法,求得斐波那契数列的第n项,为了得到这个结果,我们还需要由[an-2 an-1]推得[an-1 an]我们设[an-2an-1]为矩阵A,因为A1×2B2×2=C1×2,所以C与A是同规模的矩阵[an-2 an-1] = [an-1 an]
2014-07-20 10:48:52 753
原创 FZU oj 1683 纪念SlingShot(矩阵快速幂)
http://acm.fzu.edu.cn/problem.php?pid=1683自己独立完成的矩阵快速幂,O(∩_∩)O哈哈~Description已知 F(n)=3 * F(n-1)+2 * F(n-2)+7 * F(n-3),n>=3,其中F(0)=1,F(1)=3,F(2)=5,对于给定的每个n,输出F(0)+ F(1)+ …… + F(n) mod 2009。
2014-07-20 10:42:40 483
原创 HDU 1568 Fibonacci
Problem Description2007年到来了。经过2006年一年的修炼,数学神童zouyu终于把0到100000000的Fibonacci数列(f[0]=0,f[1]=1;f[i] = f[i-1]+f[i-2](i>=2))的值全部给背了下来。接下来,CodeStar决定要考考他,于是每问他一个数字,他就要把答案说出来,不过有的数字太长了。所以规定超过4位的只要说出前4位就
2014-07-19 17:42:07 605
原创 HDU2141Can you find it?
HDU2141Can you find it? http://acm.hdu.edu.cn/showproblem.php?pid=2141这个题吧,
2014-07-18 17:21:30 571
原创 2013暑期第一周周赛G题 错误总结
DescriptionLet's call a number k-good if it contains all digits not exceedingk (0, ..., k). You've got a numberk and an array a containingn numbers. Find out how many k-good numbers are in
2014-07-18 16:47:16 489
原创 poj 1017 Packets
poj 1017 http://poj.org/problem?id=1017原本bug超多的代码#includeint main(){ int a[7]; while(scanf("%d %d %d %d %d %d",&a[1],&a[2],&a[3],&a[4] ,&a[5],&a[6]) &&(a[1]+a[2]+a[3]+a[4]+a[5]+a[6] !
2014-07-16 14:04:16 456
转载 HDU 1205 吃糖果
思路:鸽巢原理证明: 1.把某种糖果看做隔板,如果某种糖果有n个,那么就有n+1块区域,至少需要n-1块其他种糖果才能使得所有隔板不挨在一块..也就是说能吃完这种糖果.至少需要其他种类糖果n-1块..(鸽巢原理) 2.数量最多的糖果(隔板)可以构造最多的空间,如果这种糖果有maxn个....那么需要maxn-1个其他种糖果.对
2014-07-15 19:24:30 593
原创 Hdu 1004 Let the Balloon Rise map解决方法
原题地址http://acm.hdu.edu.cn/showproblem.php?pid=1004
2014-07-15 19:14:38 576
转载 poj 1700 贪心算法(1)
#include#includeusing namespace std;int a[1005] = {0};int main(){ int t,i; scanf("%d",&t); for(i=0;i<t;i++) { int n,j,s = 0; scanf("%d",&n); for(j=0;j<n;j+
2014-07-15 11:28:05 833
转载 大数计算器
//设计一个支持大数运算的计算器,其中乘法使用分治法求解。该计算器支持加减乘除还有开方根运算。#include #include #include #include #include #include using namespace std;list Add(list s, list t);list Sub(list s, list t);list Mul(list s, li
2014-07-14 16:52:20 1635
转载 大整数的加减乘除取模
#include #include using namespace std;inline int compare(string str1, string str2){ if(str1.size() > str2.size()) //长度长的整数大于长度小的整数 return 1; else if(str1.size() < str2.siz
2014-07-14 16:49:21 1433
Linux下 QT 连接 Mysql 出现问题
2014-12-21
TA创建的收藏夹 TA关注的收藏夹
TA关注的人