自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(49)
  • 资源 (1)
  • 收藏
  • 关注

原创 河南第六届ACM省赛(探 寻 宝 藏)(双线程DP)

题目地址:http://acm.nyist.net/JudgeOnline/problem.php?pid=712思路:比较裸的双线程DP吧AC代码:#include #include #include #include #include #include #include #include #include #include #include const int

2016-04-28 17:37:22 864

原创 HDU 2686 Matrix(双线程DP)

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=2686题意:从矩阵的(1,1)到(n,n)再从(n,n)到(1,1)中间不经过重复的值,来回能走过的最大值是多少思路:打个来回可以直接想成从2个人同时从(1,1)到(n,n)且不经过同一个位置大神地址1:http://blog.csdn.net/yan_____/article/detail

2016-04-28 17:20:31 475

原创 HDU 2155 小黑的镇魂曲

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=2155思路:大神地址:http://www.aiuxian.com/article/p-1671720.html代码:#include #include #include #include #include #include #include #include #includ

2016-04-28 11:49:26 590

原创 HDU 1248 寒冰王座(完全背包)

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1248思路:比较裸的完全背包AC代码:#include #include #include #include #include #include #include #include #include #include #include const int inf = 0

2016-04-28 09:09:28 258

原创 HDU 1284 钱币兑换问题(母函数,完全背包)

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1284思路:AC代码:#include #include #include using namespace std;int dp[40000];int main(){ memset(dp,0,sizeof(dp)); dp[0] = 1; for(int

2016-04-27 21:48:09 483

原创 POJ 1125 Stockbroker Grapevine(Floyd)

题目地址:http://poj.org/problem?id=1125题意:有一群买股票的人,如何从中间选择一个人使得所有人都知道这个消息的时间最短思路:先把N个人中最短路径中最长的算出来,再从N个人最长的路径中找出最短的AC代码:#include #include #include using namespace std;const int inf = 0x3f3f3f3

2016-04-27 19:21:22 264

原创 POJ 1042 Gone Fishing(模拟+贪心)

代码:#include #include #include using namespace std;struct node{ int first; int reduce;}a[30];int b[30];int time[30];int pre[30][30];int c[30];int main(){ int n,h; while(sc

2016-04-26 21:28:00 290

原创 HDU 1664 放苹果

题目地址:http://poj.org/problem?id=1664思路:大神地址:http://www.cnblogs.com/dongsheng/archive/2012/08/15/2640468.htmlAC代码:#include #include #include #include #include #include #include #include #i

2016-04-26 15:05:19 437

原创 HDU 1028 Ignatius and the Princess III(整数拆分问题)

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1028思路:母函数,递归,DP都能写,母函数题解地址:http://blog.csdn.net/qq_25605637/article/details/46911309写的比较好的博客:http://blog.chinaunix.net/uid-26548237-id-3503956.html,

2016-04-26 11:50:46 396

原创 HDU 5074 Hatsune Miku(暴力+DP)

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=5074思路:暴力+DPAC代码:#include #include #include #include #include #include #include #include #include #include #include const int inf = 0x3f

2016-04-25 21:42:54 309

原创 HDU 2859 Phalanx(二维DP)

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=2859题意:求最大的对称矩阵思路:从右上角到左下角进行DPAC代码:#include #include #include #include #include #include #include #include #include #include #include

2016-04-25 15:15:29 280

原创 ZOJ Defuse the Bomb

题目地址:思路:AC代码:#include #include #include #include #include #include #include #include #include #include #include const int inf = 0x3f3f3f3f;//1061109567typedef long long LL;#define l

2016-04-23 16:06:36 610

原创 HDU 5671 Matrix

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=5671思路:另开数组记录操作AC代码:#include #include #include #include #include #include #include #include #include #include #include const int inf = 0

2016-04-23 14:59:09 277

原创 HDU 5670 Machine

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=5670思路:用递归实现输出在后,比较麻烦,保存在数组里,倒着输出数组比较方便AC代码:#include #include #include #include #include #include #include #include #include #include #in

2016-04-23 14:44:52 240

原创 HDU 1541 Stars

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1541题意:给出n个坐标,先按纵坐标升序,纵坐标相同再按横坐标升序排序,在这个点左下角的个数记做这个数的level值(不严格,纵坐标和横坐标可以相同),求0到n-1的level数是多少思路:update单点更新,query区间求值AC代码:#include #include #inc

2016-04-22 18:19:54 819

原创 HDU 2852 KiKi's K-Number(单点更新,求值)

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=2852题意:0 e 往容器里翻一个数e   1 e 从容器里删除一个数e 2 a k 求第k个比a大的数AC代码:#include #include #include #include #include #include #include #include #incl

2016-04-22 17:27:08 286

原创 HDU 1540 Tunnel Warfare(区间合并)

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1540题意:给一个村子求直接和间接和它连着的村子有多少个思路:#include #include #include #include #include #include #include #include #include #include #include const

2016-04-21 21:22:53 226

原创 HDU 3308 LCIS(最长连续上升子序列)

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=3308思路:update单点更新,query求一段区间内的最长连续上升子序列大神地址:http://leehuan.sinaapp.com/acm-icpc/hdoj/465.htmlAC代码:#include #include #include #include #includ

2016-04-21 17:33:17 382

原创 POJ 3667 Hotel(区间合并)

题目地址:http://poj.org/problem?id=3667题意:1 a:询问是不是有连续长度为a的空房间,有的话住进最左边2 a b:将[a,a+b-1]的房间清空思路:记录区间中最长的空房间思路:update区间替换,query求满足条件的最左边的一个房间AC代码:#include #include #include #include #include

2016-04-21 13:48:38 281

原创 HDU 1798 Tell me the area

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1798题意:给了你2个圆的坐标和半径,问2个圆相交的面积是多少思路:注意要用公式求出来的pi,不然会造成精度问题,因为题目没有限定在哪一个范围内,给一个大神的题解地址写的很详细:http://blog.csdn.net/ice_crazy/article/details/7694090AC代

2016-04-19 15:33:46 278

原创 郑轻校赛总结

2个经验(1)把简单题想成难题,不愿动脑(2)和队友交流太少1882: 蛤玮的魔法思路:用相似求比率,都是泪啊,用三角函数时注意里面要用弧度制AC代码:#include #include #include #include #include #include #include #include #include #include #include const

2016-04-18 18:55:30 464

原创 训练赛总结

A(HDU 1877)题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1877思路:简单的进制转换,由于没有特判0,wrong了AC代码:#include #include #include #include #include #include #include #include #include #include

2016-04-18 15:33:13 476

原创 HUD 1881 毕业bg(01背包变形)

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1881思路:看到这道题时根本没一点思路,没想到是01背包,挺好的一题,欢乐度看成是价值,持续时间看成是体积,发起人离开时间看成是容量,容量只能是从小到大进行DP,所以要对结构体排一下序,在结构体内写排序函数还是头一次见,练习一下,看了别人的代码A的,有很多地方不了解AC代码:#include

2016-04-18 14:59:12 522

原创 ZOJ 1985 Largest Rectangle in a Histogram

题目地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1985思路:枚举起始点O(n^3)肯定超时,O(n^2)都超时了,参考别人博客写的,用left和right数组保存比当前矩形高度高的最小下标和最大下标待测代码:#include #include #include #include #includ

2016-04-14 12:19:31 371

原创 nyist 311 完全背包

题目地址:http://acm.nyist.net/JudgeOnline/problem.php?pid=311思路:待测代码1:#include #include #include #include #include #include #include #include #include #include #include const int inf = 0x

2016-04-12 18:44:59 278

原创 HDU 1394 Minimum Inversion Number

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1394题意:在序列 { 2, 4, 3, 1 } 中,逆序依次为 (2,1), (4,3), (4,1), (3,1),因此该序列的逆序数为 4,题目给定一个长度为n的数组,每次可以把数组的前m个元素移动到数列的后面,所以共有n种数列,求这n种序列中,逆序数最小的一个思路:(1)从第一种情况,递

2016-04-12 17:29:11 209

原创 模板2

最小生成树(Prim,Kruskal)求城市的最小生成树,城市标号是从0到n-1,注意重边和不能构成的情况const int zui = 1000000000;int n,m;int map1[1010][1010];int lowdist[1010];int visit[1010];int sum;bool flag;void Prim(){ int i,j,k

2016-04-10 09:50:19 324

原创 模板1

并查集(1)int find(int x){ return x == pre[x] ? x : pre[x] = find(pre[x]);}void join(int x,int y){ int fx = find(x); int fy = find(y); if(fx != fy) pre[fx] = fy;}(2)求最大秩的集

2016-04-09 21:22:22 391

原创 2546 饭卡(01背包,挺好的)

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=2546思路:AC代码:错误代码:#include #include #include #include #include #include #include #include #include #include #include const int inf

2016-04-09 21:06:58 283

原创 HDU 2076 夹角有多大(题目已修改,注意读题)

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=2076思路:都取相对于12点转过的角度AC代码:#include #include #include #include #include #include #include #include #include #include #include const int in

2016-04-09 19:28:55 282

原创 HDU 1106 排序(切割字符串)

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1106思路:给点测试数据555445555   输出44544                输出4415551            输出1 1AC代码1:#include #include #include #include #include #include #

2016-04-09 19:23:02 324

原创 CCF 最优灌溉

问题描述试题编号:201412-4试题名称:最优灌溉时间限制:1.0s内存限制:256.0MB问题描述:问题描述  雷雷承包了很多片麦田,为了灌溉这些麦田,雷雷在第一个麦田挖了一口很深的水井,所有的麦田都从这口井来引水灌溉。  为了灌溉,雷雷需要建立一些水渠,以连

2016-04-09 17:43:30 708

原创 文章标题

问题描述 试题编号: 201503-2 试题名称: 数字排序 时间限制: 1.0s 内存限制: 256.0MB 问题描述: 问题描述   给定n个整数,请统计出每个整数出现的次数,按出现次数从多到少的顺序输出。 输入格式   输入的第一行包含一个整数n,表示给定数字的个数。   第二行包含n个整数,相邻的整数之间用一个空格分隔,表示所给定的整数。 输出格式

2016-04-07 17:12:21 285

原创 CCF 节日

AC代码:#include #include #include #include #include #include #include #include #include #include #include const int inf = 0x3f3f3f3f;//1061109567typedef long long LL;#define lson l,m,rt<<

2016-04-07 15:51:55 886

原创 CCF 日期计算

问题描述试题编号:201509-2试题名称:日期计算时间限制:1.0s内存限制:256.0MB问题描述:问题描述  给定一个年份y和一个整数d,问这一年的第d天是几月几日?  注意闰年的2月有29天。满足下面条件之一的是闰年:  1) 年份是4的整数倍,而且不

2016-04-07 12:34:17 1760

原创 CCF 集合竞价

#include #include #include #include #include #include #include #include #include #include #include const int inf = 0x3f3f3f3f;//1061109567typedef long long LL;#define lson l,m,rt<<1#defi

2016-04-06 19:52:04 1229

原创 POJ 2192 Zipper

题目地址:http://poj.org/problem?id=2192思路:因为只能依次取,所以c[i+j]这个字符肯定是由a[i]或者b[j]构成的AC代码:#include #include #include #include #include #include #include #include #include #include #include cons

2016-04-06 18:36:47 362

原创 CCF 字符串匹配

问题描述试题编号:201409-3试题名称:字符串匹配时间限制:1.0s内存限制:256.0MB问题描述:问题描述  给出一个字符串和多行文字,在这些文字中找到字符串出现的那些行。你的程序还需支持大小写敏感选项:当选项打开时,表示同一个字母的大写和小写看作不同的字符;

2016-04-06 12:53:36 1069

原创 CCF Z字形扫描

问题描述试题编号:201412-2试题名称:Z字形扫描时间限制:2.0s内存限制:256.0MB问题描述:问题描述  在图像编码的算法中,需要将一个给定的方形矩阵进行Z字形扫描(Zigzag Scan)。给定一个n×n的矩阵,Z字形扫描的过程如下图所示:  对

2016-04-05 17:04:17 641

原创 CCF 窗口

问题描述试题编号:201403-2试题名称:窗口时间限制:1.0s内存限制:256.0MB问题描述:问题描述  在某图形操作系统中,有 N 个窗口,每个窗口都是一个两边与坐标轴分别平行的矩形区域。窗口的边界上的点也属于该窗口。窗口之间有层次的区别,在多于一个窗口重叠的

2016-04-05 15:26:11 649

C语言算法经典

C语言入门,C语言算法,C语言程序,C语言经典

2015-02-07

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除