自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(18)
  • 收藏
  • 关注

原创 HDU 5338 ZZX and Permutations

ZZX and Permutations题解 线段树+set

2015-08-11 10:40:32 43498 1

转载 欧拉函数+中国剩余定理

好久没写文章了。。总结欧拉函数:欧拉函数就是对于整数n,不超过n且与n互质的数的个数。若mn为互质的正整数,那么f(mn)=f(m)*f(n);因为任意正整数都可以唯一表示成如下形式:                     k=p1^a1*p2^a2*……*pi^ai;(即分解质因数形式)    可以推出:E(k)=(p1-1)(p2-1)……(pi-1)*(p1^(

2015-07-29 17:54:53 4557

原创 c++ next_permutation()函数的使用

next_permutation()函数在algorithm头文件里,参数为一个数组或字符串的头尾指针,返回值为bool型,调用后自动为数组排序。按照字典序从小到大,比如1234的next_permutation(a,a+4)就是1243.而4321的next_permutation()返回值即为false。相应的,c++中还有一个prev_permutation()函数,跟next倒着。

2015-04-07 20:02:21 574

原创 hdu 2795 (线段树)

原题在此题意是在学校门前有一块宣传板,长w,高h,按照单位长度划分成h行。有n个长度分别为wi(1这题用线段树的算法,我第一次没有想到,比较巧妙。把展板旋转九十度,从1到min(h,n)的一行,用每个变量来存下面每一行的长度w,构造线段树,节点上保存下面的长度的最大值。更新的时候就减去相应节点的wi,然后返回那个节点的L或者R,就是应该贴在的那一行。代码:#

2015-03-18 11:29:07 379

原创 hdoj 1509 Windows Message Queue 优先队列

Windows Message QueueTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4049    Accepted Submission(s): 1591Problem DescriptionMess

2015-03-12 22:03:10 435

原创 hdu 1010 Tempter of the Bone (dfs+剪枝)

题目传送门简单的dfs和剪枝,卡了一天才过。注意:是t时刻恰好到达door,不能提前也不能滞后。还有一个小技巧叫做奇偶剪枝,如下:从一个点a到另一个点b走的步数最少应该是abs(ax-bx)+abs(ay-by);即上下和左右都向目标的方向走,每一步都更近,示意如下:s    |    

2014-12-13 22:22:31 273

原创 zoj 3811 Untrusted Patrol 牡丹江网络赛c题

Untrusted PatrolTime Limit: 3 Seconds      Memory Limit: 65536 KBEdward is a rich man. He owns a large factory for health drink production. As a matter of course, there is a large warehouse in

2014-10-27 20:33:42 313

原创 简易计算器(栈的应用)

简单计算器Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64uSubmit Status Practice HDU 1237Description读入一个只包含 +, -, *, / 的非负整数计算表达式,计算该表达式的值。  In

2014-10-07 12:07:07 611

转载 zoj 1002 Fire Net (简单dfs)

Fire NetTime Limit: 2 Seconds      Memory Limit: 65536 KBSuppose that we have a square city with straight streets. A map of a city is a square board with n rows and n columns, each representin

2014-09-07 21:22:58 407

原创 poj 1166 敌兵布阵 线段树

敌兵布阵Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 44035    Accepted Submission(s): 18715Problem DescriptionC国的死对头A国这段时间正在进行军事演

2014-08-13 19:59:47 615

原创 hdu 2571 fate 动态规划水题

FateTime Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64uSubmit StatusDescription穿过幽谷意味着离大魔王lemon已经无限接近了!可谁能想到,yifenfei在斩杀了一些虾兵蟹将后,却再次面临命运大迷宫的考验,这是魔王lemon设

2014-08-05 20:34:22 1043

原创 hdu 1227 fast food 动态规划

Fast FoodTime Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64uSubmit Status Practice HDU 1227DescriptionThe fastfood chain McBurger owns several restaurant

2014-08-05 11:16:16 518

原创 hit oj 1760 The jackpot (最大子段和)

As Manuel wants to get rich fast and without too much work, he decided to make a career in gambling. Initially, he plans to study the gains and losses of players, so that, he can identify patterns of

2014-08-05 10:38:59 358

原创 HDU 2046+HDU1143(递推)覆盖问题

骨牌铺方格Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 28534    Accepted Submission(s): 13842Problem Description在2×n的一个长方形方格中,用一个1

2014-07-31 19:54:31 530

原创 poj1753 FlipGame

Flip GameTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 30172 Accepted: 13094DescriptionFlip game is played on a rectangular 4x4 field with two-sided p

2014-07-22 19:59:47 291

转载 快速幂模

a^b mod c  0/**//****************************************************/// 模取幂运算 计算a^b mod c// 利用公式 // (a*b)mod(c) = ((a mod c )*b)mod c

2014-07-22 09:57:09 306

原创 hdu 1232 畅通工程 并查集

畅通工程Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64uSubmit StatusDescription某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有

2014-05-18 11:55:17 333

原创 poj 3253 Fence repair

Fence RepairTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 24144 Accepted: 7698DescriptionFarmer John wants to repair a small length of the fence aroun

2014-05-17 21:29:45 312

空空如也

空空如也

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

TA关注的人

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