自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 hdu 5592 BestCoder Round #65 1003

ZYB's Premutation                                          Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Problem DescriptionZYB has a premutation P,b

2015-12-22 17:27:10 320

原创 hdu 5596 bestcode #66 1002

GTW likes gtTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 800    Accepted Submission(s): 291Problem DescriptionLong long ago, th

2015-12-17 20:19:45 438

原创 codeforces #242 abcd

A:链接:http://codeforces.com/problemset/problem/424/A题目大意:统计x的个数是不是总数一半,不是的话要变成一半所需改变次数以及改变后的序列代码:#include #include using namespace std;int main(){ char c[220]; int n; while(sca

2015-12-15 20:44:35 398

原创 CodeForces 412D Giving Awards

D. Giving Awards                                                                                            time limit per test      1 second                                                 

2015-12-02 20:58:39 320

原创 codeforces 390C Inna and Candy Boxes

C. Inna and Candy Boxes                                                                                              time limit per test             1 second                                 

2015-11-13 17:48:11 314

原创 codeforces 390B Inna, Dima and Song

B. Inna, Dima and Song                                                                                    time limit per test            1 second                                             

2015-11-13 17:37:48 260

原创 codeforces 390A Inna and Alarm Clock

A. Inna and Alarm Clock                                                                                 time limit per test               1 second                                            

2015-11-13 17:31:15 386

原创 codeforces 389b Fox and Cross

B. Fox and Cross                              time limit per test  1 second                           memory limit per test   256 megabytesinputstandard inputoutputstandard out

2015-11-13 17:24:56 385

原创 codeforces 389A Fox and Number Game

Fox and Number Game                                                                                time limit per test          1 second                                                      

2015-11-13 17:18:29 578

原创 codeforces 402B Trees in a Row

B. Trees in a Row                                                                                                  time limit per test     1 second                                           

2015-11-07 15:43:02 341

原创 CodeForces 401C Team

TeamTime Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u  DescriptionNow it's time of Olympiads. Vanya and Egor decided to make his own team to take part in a programming

2015-11-06 16:56:21 341

原创 CodeForces 401B Sereja and Contests

Sereja and ContestsCrawling in process...Crawling failedTime Limit:1000MS    Memory Limit:262144KB     64bit IO Format:%I64d & %I64u      DescriptionSereja is a coder and he like

2015-11-06 16:52:32 331

原创 CodeForces 401A Vanya and Cards

Vanya and CardsCrawling in process...Crawling failed                                       Time Limit:1000MS    Memory Limit:262144KB     64bit IO Format:%I64d & %I64u      Descripti

2015-11-06 16:50:06 261

原创 hud 4614 线段树+二分

Vases and Flowers                                                       Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Problem Description  Alice is so popu

2015-11-06 16:42:37 279

原创 codeforces 400C Inna and Huge Candy Matrix

题目链接:http://codeforces.com/problemset/problem/400/C题目大意:给出一个n*m的矩阵,其中有p个格子里边有糖果,知道这p个格子现在的位置,现在要将这个n*m的矩阵顺时针旋转x次,水平翻转y次,逆时针旋转z次,最后输出原来的p个有糖果的格子现在的坐标解题思路:顺时针旋转一次(x,y)--->(y,n+1-x)顺时针旋转二次(x,y)

2015-10-31 16:07:56 357

原创 codeforces 400B Inna and New Matrix of Candies

B. Inna and New Matrix of CandiesInna likes sweets and a game called the "Candy Matrix". Today, she came up with the new game "Candy Matrix 2: Reload".The field for the new game is a rectangle

2015-10-31 16:03:29 292

原创 CodeForces 400A Inna and Choose Options

A. Inna and Choose Options                                                                                                            time limit per test      1 second

2015-10-31 15:57:13 291

原创 hdu 3974 线段树重新排序区间更新

Assign the task                                                                Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Problem DescriptionThere is a

2015-10-30 14:04:58 463

原创 hdu 1540 线段树区间合并

Tunnel Warfare                                                                          Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Problem Description

2015-10-18 17:39:34 249

原创 hdu 5495 LCS (bestcoder #58 1002)

LCSTime Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Problem DescriptionYou are given two sequence {a1,a2,...,an}     and {b1,b2,...,bn}.    Both

2015-10-04 10:50:35 307

原创 hdu Can you answer these queries? 线段树成段更新

Can you answer these queries?                                                  Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65768/65768 K (Java/Others)Problem DescriptionA lot of

2015-09-30 17:39:54 213

原创 zoj 1610 Count the Colors 线段树区间更新——染色问题

Count the ColorsTime Limit: 2 Seconds      Memory Limit: 65536 KBPainting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones.Your ta

2015-09-28 20:04:03 295

原创 hdu 1698 Just a Hook 线段树区间更新

Just a Hook                                                                  Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Problem DescriptionIn the

2015-09-23 15:40:57 233

原创 poj 2528 Mayor's posters 线段树+离散化

题目大意:n个人依次贴海报,每张海报都有张贴范围(li以下解法是摘大神博客的- -,勿喷。解法:离散化,如下面的例子(题目的样例),因为单位1是一个单位长度,将下面的      1   2   3   4  6   7   8   10     —  —  —  —  —  —  —  —      1   2   3   4  5   6   7  

2015-09-22 20:49:04 170

原创 poj 3468 A Simple Problem with Integers

A Simple Problem with IntegersTime Limit: 5000MS Memory Limit: 131072K   Case Time Limit: 2000MSDescriptionYou have N integers, A1, A2, ... , AN. You need t

2015-09-21 18:17:33 198

原创 hdu 1754 I Hate It 线段树

I Hate It                                                          Time Limit: 9000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Problem Description很多学校流行一种比较的习惯。老师们

2015-09-18 18:58:10 250

原创 hdu 2612 Find a way

题目大意:Y和M寻找最近的kfc(@)求最短路径是两人耗时最少;解题思路:典型bfs,用三维数组记录@的最少步数。注:三维数组初始化为最大值,因为可能有的@两人有人到不了;代码:#include #include #include using namespace std;int vis[205][205];int dir[4][2]={1,0,-1,0,0,1,0,-1}

2015-09-16 21:35:01 243

原创 hdu 1495 非常可乐

题目大意:中文题- -解题思路:跟poj3414类似,题目本身不难,只是需要列举的状态比较多,用bfs,把情况列举出来就行了。链接:http://acm.hdu.edu.cn/showproblem.php?pid=1495代码:#include #include #include using namespace std;int m,n,s;struct node{

2015-09-16 20:16:35 317

原创 poj 3984 迷宫问题

题目大意:中文题- -;解题思路:用数组模拟队列,记一下每一个元素上一个元素位置就可以了;链接:http://poj.org/problem?id=3984代码:#include using namespace std;int map[6][6];int dir[4][2]= {1,0,-1,0,0,1,0,-1};struct node{ int x,y;

2015-09-14 20:49:01 295

原创 uva 11624 Fire

题目大意:一个平面迷宫中有一个人,迷宫中有些点起火了,火和人每个单位时间只能向相邻的格子移动,其中有一些空间被墙壁占据,问这个人在不背或烧到的情况下,离开迷宫的最快时间。大部分人用两个bfs,我觉得一个就行,先把起火点压入队列(起火点可能有多个),最后把人压入队列,bfs即可,第一道没看别人博客写的- -;ps:由于dir数组初始化赋值弄错了,以至于看了两天,怎么看都觉得挺

2015-09-14 18:29:52 334

原创 fzu 2150 Fire Game

题目大意:两个熊孩子点草烧,#代表草,求烧完全部需要的最小时间,点不完所有的输出-1;解题思路:由于数据小,所以可以枚举两个燃烧点,压入队列,求出最小时间;代码:#include #include #include #include using namespace std;const int maxn=0xfffffff;int n,m,t;char map[210][2

2015-09-11 19:23:44 254

原创 poj 3414 Pots bfs

题目大意: 有二个水壶,对水壶有三种操作,1)FILL(i),将i水壶的水填满,2)DROP(i),将水壶i中的水全部倒掉,3)POUR(i,j)将水壶i中的水倒到水壶j中,若水壶 j 满了,则 i 剩下的就不倒了,问进行多少步操作,并且怎么操作,输出操作的步骤,两个水壶中的水可以达到C这个水量。如果不可能则输出impossible。初始时两个水壶是空的,没有水;解题思路:分别对a和b

2015-09-10 16:22:55 253

原创 poj 3087 Shuffle'm Up

题目大意:已知两堆牌s1和s2的初始状态, 其牌数均为c,按给定规则能将他们相互交叉组合成一堆牌s12,再将s12的最底下的c块牌归为s1,最顶的c块牌归为s2,依此循环下去,现在输入s1和s2的初始状态 以及 预想的最终状态s12,问s1 s2经过多少次洗牌之后,最终能达到状态s12,若永远不可能相同,则输出"-1"。解题思路:用map模拟,当a与b以前出现过,那么无解;代码

2015-09-09 19:58:09 225

原创 poj 3126 Prime Path bfs

题目大意:给定两个四位素数a  b,要求把a变换到b变换的过程要保证  每次变换出来的数都是一个 四位素数,而且当前这步的变换所得的素数  与  前一步得到的素数  只能有一个位不同,而且每步得到的素数都不能重复。求从a到b最少需要的变换次数。无法变换则输出Impossible。解题思路:数组模拟队列,先打出10000以内的素数表,然后bfs搜索每一位变化后是否为素

2015-09-08 21:37:27 211

原创 poj 1426 Find The Multiple 简单搜索

题目大意:给定一个n,求出一个由1 0组成的十进制数是n的倍数;解题思路:由于随便输出结果中一个,所以dfs便可以,逐步搜索;ps:每次都说是简单搜索,可每次都是看解题报告才明白- -#注意:k和n都是long long代码:#include using namespace std;long long n;bool flag;int i;void dfs(long

2015-09-08 20:26:37 231

原创 poj 3278 简单搜索bfs

题目链接:http://poj.org/problem?id=3278题目大意:给出两个数n,k;经过两种操作使n成为k所需要的步数;操作1:n=n+1或n=n-1;操作2:n=n×2;解题思路:用bfs搜索,vis数组标记状态同时记录到当前位置所用的步数;代码:#include #include #include using namespace std;int n,k;

2015-09-07 20:38:17 263

原创 poj 2251 简单搜索bfs

题目链接:http://poj.org/problem?id=2251题目大意:  给出一三维空间的地牢,要求求出由字符'S'到字符'E'的最短路径移动方向可以是上,下,左,右,前,后,六个方向每移动一次就耗费一分钟,要求输出最快的走出时间。不同L层的地图,相同RC坐标处是连通的;解题思路:其实就是多了两个方向,map数组开诚三维的就行了;代码:

2015-09-07 19:54:45 231

原创 poj 1321 棋盘问题

题意很简单- -;解题思路:dfs搜索,逐行搜索,但需要注意当n!=k时,搜索完需要从当前行下一行继续搜索,具体见代码;代码:#include #include using namespace std;char map[10][10];int col[10];//列标记数组;int k,n;int cnt;void dfs(int row,int num){ i

2015-09-07 18:35:12 194

原创 hdu 1241 深搜水题

Oil Deposits                                                                  Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionThe Ge

2015-09-02 21:19:15 230

原创 poj 3159 Candies

题意:班上有n个同学,现在有一些糖要分给他们,设第i个同学得到的糖为p[i],分糖必须满足条件:第i个同学要求第j个同学的糖不能超过自己k个,即p[j] - p[i] = 0。要求在满足这些条件的情况下,求出p[n] - p[1]的最大值;最短路问题,就是求有向图最短路,因为假设2比1最多多2个,3比2最多多3个,1比3最多多4个,假如选择1->2->3则3比1最多多5个不符合1比3最多多4个

2015-08-20 19:00:42 183

空空如也

空空如也

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

TA关注的人

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