自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 POJ 3617 (贪心)

题目地址:http://poj.org/problem?id=3617别人的代码,有时间看看AC代码:#include char s[2002], tmp[2];int n;int main(){ while(~scanf("%d", &n)) { for(int i=0;i<n;i++) { scanf(

2016-05-31 19:43:30 397

原创 POJ 2376 Cleaning Shifts(贪心)

题目地址:http://poj.org/problem?id=2376思路:起点为1的选一个最大的,剩下的放到结构体中,排序一下贪心就行AC代码:#include #include #include #include #include #include #include #include #include #include #include const int i

2016-05-31 18:45:37 288

原创 POJ 2440 DNA(递推)

题目地址:http://poj.org/problem?id=2440思路:先暴力打数据,再递推,循环节为200AC代码:#include #include #include #include #include #include #include #include #include #include #include const int inf = 0x3f3f3

2016-05-31 18:37:40 405

原创 POJ 2304 Combination Lock(模拟)

题目地址:http://poj.org/problem?id=2304题意: 模拟一个开组合的密码锁过程。就像电影你开保险箱一样,左转几圈右转几圈的就搞定了。这个牌子的锁呢,也有它独特的转法。这个锁呢,有一个转盘,刻度为0~39。在正北方向上有一个刻度指针。它的密码组合有三个数,开锁的套路为:先把刻度盘顺时针转两圈,然后再顺时针转到第一个数,再把刻度盘逆时针转一圈,再逆时针转到第二个数,最后再

2016-05-29 21:39:01 431

原创 POJ 3661 Running(朴素DP)

题目地址:http://poj.org/problem?id=3661思路:到达第n分钟时,有可能是跑过来的有可能是直接休息到的,区分一下就行AC代码:#include #include #include #include #include #include #include #include #include #include #include const in

2016-05-29 19:24:28 388

原创 POJ 3230 Travel(朴素DP)

题目地址:http://poj.org/problem?id=3230思路:看清题就行,没钱的时候还能欠债AC代码:#include #include #include #include #include #include #include #include #include #include #include const int inf = 0x3f3f3f3f

2016-05-29 18:27:45 391

原创 HDU 5015 233 Matrix(矩阵快速幂)

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=5015思路:大神地址:http://blog.csdn.net/v5zsq/article/details/50775372,讲的很好,一列一列推AC代码:#include #include #include #include #include #include #include

2016-05-28 20:32:31 253

原创 HDU 4552 怪盗基德的挑战书(很巧妙的暴力)

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=4552思路:很巧妙的暴力AC代码:#include #include #include #include #include #include #include #include #include #include #include const int inf = 0x3

2016-05-28 19:26:49 484

原创 POJ 3663 Costume Party(模拟+减枝)

题目地址:思路:别人排序一下,在跑2层for循环的过程中减值,我用数组压缩了一下AC代码:#include #include #include #include #include #include #include #include #include #include #include const int inf = 0x3f3f3f3f;//1061109567

2016-05-28 18:04:48 326

原创 HDU 1164 Eddy's research I(素因子拆分)

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1164思路:每次除小于它的数就行,不用先筛一遍素数,刚开始筛素数的时候下标超int了,头一次遇到,因为任何一个数都能分解成素数之积,举个例子啊,如果能被4整除AC代码1:#include #include #include #include #include #include #

2016-05-19 15:48:09 295

原创 HDU 2255 奔小康赚大钱(KM)

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=2255思路:比较裸的KM算法KM算法讲解的一些地址:主要思想:http://wenku.baidu.com/view/28203c49767f5acfa1c7cd38.html代码过程详解:http://wenku.baidu.com/link?url=oUbIxhSFz_PFzGb-M

2016-05-18 21:14:03 415

原创 HDU 1757 A Simple Math Problem(矩阵快速幂)

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1757思路:直接递推肯定超时,比赛的时候就想着找规律,如何把递推式转化为f1到f9的和规律,想炸了,没想到时矩阵快速幂,能把时间压为log(n),不会超时,代码也很好写AC代码:#include #include #include #include #include #includ

2016-05-18 10:57:40 262

原创 nyist 301 递推求值(矩阵快速幂)

题目地址:http://acm.nyist.net/JudgeOnline/problem.php?pid=301思路:AC代码:

2016-05-17 21:36:36 332

原创 POJ 3070 Fibonacci(矩阵快速幂)

题目地址:http://poj.org/problem?id=3070思路:矩阵快速幂和快速幂的思想差不多,快速幂详解地址:http://blog.csdn.net/qq_25605637/article/details/47357119,按照下面2张图来就行AC代码:#include #include #include #include #include #incl

2016-05-17 16:47:22 384

原创 HDU 1498 50 years, 50 colors(最小顶点覆盖)

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1498思路:和HDU2119有点像,枚举每种颜色的气球就行AC代码:#include #include #include #include #include #include #include #include #include #include #include co

2016-05-15 20:41:13 425

原创 二分图总结

最大匹配数=最小点覆盖最小路径覆盖 = 顶点数 – 最大匹配

2016-05-14 19:45:54 276

原创 HDU 4500 小Q系列故事——屌丝的逆袭(水题)

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=4500思路:简单模拟AC代码:#include #include #include #include #include #include #include #include #include #include #include const int inf = 0x3f3

2016-05-13 16:05:25 377

原创 HDU 4502 吉哥系列故事——临时工计划(时间安排的01背包)

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=4502思路:先按时间排序一下,跑一遍01背包就行,和1881有点像,只不过比那个简单AC代码:#include #include #include #include #include #include #include #include #include #include

2016-05-13 15:43:58 349

原创 HDU 1266 (模拟)

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1266思路:特判0就行AC代码:#include #include #include #include #include #include #include #include #include #include #include const int inf = 0x3f

2016-05-13 14:00:34 372

原创 ZOJ 1738

不太理解#include #include #include #include #include #include #include #include #include #include #include const int inf = 0x3f3f3f3f;//1061109567typedef long long ll;const int maxn = 40000

2016-05-11 19:16:36 277

原创 ZOJ 1883 Tight Words(概率DP)

题目地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=883题意:给你一个区间[0,k]从这个区间中取数,组成长度为n的一个数组,求数组中每个相邻位的差不超过1的概率思路:dp[i][j]表示的是第i位且以第j结尾的数组的概率AC代码:#include #include #include #includ

2016-05-11 18:21:29 654

原创 HDU 4283 You Are the One(区间DP)

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=4283思路:这题一看特别像贪心,注意仔细读题,题目说队伍的排列顺序可以通过栈来调整,但不是每种顺序都可以通过栈来得到举个例子啊1 6 5 7 4 2 3如何调整都不会得到7 6 5 4 3 2 1AC代码:

2016-05-09 21:03:15 262

原创 HDU 3397 Sequence operation(区间合并)

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=3397思路:

2016-05-08 19:38:51 281

原创 HDU 3420 Bus Fair(贪心)

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

2016-05-08 19:34:14 530

原创 HDU 3422 Triangle

题目地址:题意:思路:AC代码:#include #include #include #include #include #include #include #include #include #include #include const int inf = 0x3f3f3f3f;//1061109567typedef long long ll;cons

2016-05-08 18:25:00 288

原创 HDU 3419 The Three Groups(回溯+减枝)

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=3419思路:注意减枝就行,不然会TLEAC代码:#include #include #include #include #include #include #include #include #include #include #include const int in

2016-05-08 17:57:47 650

原创 HDU 3402 Ants run!(比较好的贪心)

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=3402思路:还是有坑的,蚂蚁不是提前放好的,要自己放一下,放的时候肯定是将速度差不多的放在一起这样才能保证时间最长,pi要用公式求出来,不然会有精度问题放的时候还有2种方法速度最快   速度第二快 速度第三快  ... 最慢最慢...... 速度第三快  速度第二快 速度最快选择上面

2016-05-08 13:43:00 489

原创 hihoCoder挑战赛20 (区间最值)

题目地址:http://hihocoder.com/contest/challenge20/problem/1AC代码:#include #include #include #include #include #include #include #include #include #include #include const int inf = 0x3f3f3f3f

2016-05-06 21:36:53 306

原创 HDU 1151 Air Raid(最小路径覆盖)

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1151思路:对于一个有向无环图,其最小简单路径覆盖就是等于节点数减去二分图的最大匹配数AC代码:#include #include #include #include #include #include #include #include #include #include

2016-05-05 21:14:49 299

原创 nyist 740 “炫舞家“ST(DP)

题目地址:http://acm.nyist.net/JudgeOnline/problem.php?pid=740思路:错误代码:#include #include #include #include #include #include #include #include #include #include #include const int inf = 0x3

2016-05-05 11:27:33 309

原创 HDU 1292 "下沙野骆驼"ACM夏令营(DP)

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1292思路:dp[i][j]表示前j个人分成i队,dp[i][j] = dp[i-1][j-1] + dp[i][j-1] * i表示第j个人单独成一队,或者在前i队中选择一个插入AC代码:#include #include #include #include #include #

2016-05-05 08:56:56 357

原创 POJ 1122 FDNY to the Rescue!(最短路径)

题目地址:http://poj.org/problem?id=1122思路:AC代码:

2016-05-04 19:34:23 458

原创 HDU 2829 Lawrence(DP+四边形不等式优化)

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=2829思路:大神地址:http://www.tuicool.com/articles/nMzAzi6四边形不等式:http://wenku.baidu.com/view/be418243a8956bec0975e3bf.html待写代码:#include #include #incl

2016-05-04 19:33:33 381

原创 POJ 2239 Selecting Courses(最大匹配数)

题目地址:http://poj.org/problem?id=2239思路:建图的过程挺巧妙的通过(p-1)*12+q,把时间点固定在一个点上,二分图的左边是课程,右边是时间,跑一遍匈牙利算法即可,注意课程的编号不能从0开始,否则会造成给某个时间已经给0号课程用了,程序会认为没用,因为hus的数组,初始值就是0 ,你要实在想从0开始,记得把hus数组初始值赋为-1,程序里面还要再改,会比较麻烦

2016-05-04 15:38:57 326

原创 POJ 1555 Polynomial Showdown(字符串模拟)

题目地址:http://poj.org/problem?id=1555思路:注意都是0的情况输出是0,不能通过加和判断是否所有的数都为0,虽然会AC,这是数据问题,狂测的时候测出来的BUG,给个例子啊0 0 1 -1 0 0 0 0 0 虽然和为0,但是数据输出不应该是0AC代码:#include #include #include #include #include #

2016-05-02 15:24:24 411

原创 POJ 2105 IP Address(简单模拟)

题目地址:http://poj.org/problem?id=2105思路:模拟AC代码:#include #include #include #include #include #include #include #include #include #include #include const int inf = 0x3f3f3f3f;//1061109567

2016-05-02 15:08:46 430

原创 POJ 1129 Channel Allocation(图的着色问题)

题目地址:http://poj.org/problem?id=1129题意:相当于地图的着问题,临近的国家要用不同的颜色去涂,最多只需要4中颜色即可思路:枚举颜色即可AC代码:#include #include #include #include #include #include #include #include #include #include #inc

2016-05-02 15:02:04 402

C语言算法经典

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

2015-02-07

空空如也

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

TA关注的人

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